Skip to content
Skillpedia
General coding75k · #3067

type-only-imports

What it does

This skill checks TypeScript import statements and marks type-only imports correctly. It is for developers who want smaller bundles and fewer dependency problems.

When to use it

  • ✓When a TypeScript file imports modules that are only used as types.
  • ✓When a bundle includes modules that seem to be pulled in only for types.
  • ✓When setting up a new TypeScript project with clean import rules.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/type-only-imports/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/type-only-imports/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“My TypeScript build is pulling in a big module that I only use for types. Can you fix the imports?”

5 new skills a week. 1 minute to read.

How it works

The agent finds imports used only as types and changes them to import type. The compiler then removes them when the code is built.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Use import type for type-only imports

Regular imports cause the JavaScript runtime to evaluate and execute the imported module even when only a TypeScript type from that module is used. This can increase bundle size, introduce unintended side effects, and create circular dependency issues that are otherwise avoidable. Using import type makes the erased-at-runtime nature of type imports explicit and enables bundlers and the TypeScript compiler to handle them optimally.

Quick Reference

  • import type is erased entirely at compile time — no runtime module evaluation
  • Prevents accidentally importing a value when only a type is needed
  • Reduces circular dependency issues caused by type-only relationships
  • verbatimModuleSyntax in TypeScript 5 enforces this automatically

Check

Review the import statements in this TypeScript file and identify any imports where only types or interfaces are used. These should use import type instead of a regular import.

Fix

Convert the identified regular imports to import type where the imported binding is only used as a TypeScript type annotation and not as a runtime value.

Explain

Explain the difference between import and import type in TypeScript, why type-only imports should be declared explicitly, and how verbatimModuleSyntax enforces this at the compiler level.

Code Review

Inspect all import statements in this file. For each import, check whether the imported name appears only in type positions (annotations, generics, implements clauses) versus runtime positions (function calls, new, typeof). Flag any regular import that is used only as a type.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/type-only-imports

FAQ

What does import type do?

It tells the compiler the import is erased at build time, so no runtime module is loaded.

What is verbatimModuleSyntax?

It is a TypeScript 5 setting that enforces this rule automatically, according to the skill.

Can this help with circular dependencies?

The skill says avoidable circular dependencies can be reduced by using type-only imports.

Details

Original description by the author

Use when auditing import statements in TypeScript files, setting up a new TypeScript project, or investigating unexpected bundle inclusions from type-only dependencies.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#3067
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills