{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-type-only-imports-05563a795664","title":"Fix Type-Only Imports in TypeScript","summary":"Identify and convert regular imports to import type in TypeScript files to prevent runtime evaluation of type-only imports, reducing bundle size and avoiding unintended side effects.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-type-only-imports-05563a795664","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-type-only-imports-05563a795664","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-type-only-imports-05563a795664.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-type-only-imports-05563a795664\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure that the TypeScript version is 3.8 or higher to support import type syntax. Before applying changes, validate that the imported types are not used as runtime values.","instructions":"---\nname: type-only-imports\ndescription: \"Use when auditing import statements in TypeScript files, setting up a new TypeScript project, or investigating unexpected bundle inclusions from type-only dependencies.\"\nmetadata:\n  category: javascript\n  priority: low\n  difficulty: beginner\n  estimatedTime: \"10\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/javascript\/type-only-imports\n---\n\n# Use import type for type-only imports\n\nRegular 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.\n\n## Quick Reference\n\n- import type is erased entirely at compile time \u2014 no runtime module evaluation\n- Prevents accidentally importing a value when only a type is needed\n- Reduces circular dependency issues caused by type-only relationships\n- verbatimModuleSyntax in TypeScript 5 enforces this automatically\n\n## Check\n\nReview 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.\n\n## Fix\n\nConvert 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.\n\n## Explain\n\nExplain 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.\n\n## Code Review\n\nInspect 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.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/javascript\/type-only-imports\n","use_cases":["Auditing import statements in TypeScript files","Setting up a new TypeScript project","Investigating unexpected bundle inclusions from type-only dependencies"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/type-only-imports\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T06:03:23.000000Z","updated_at":"2026-11-24T07:12:47.000000Z","seo_title":"Fix Type-Only Imports in TypeScript","seo_description":"Learn how to use import type for type-only imports in TypeScript to avoid runtime evaluation and improve bundle size.","seo_keywords":["TypeScript type-only imports","Fix import type in TypeScript","Avoid runtime evaluation in TypeScript"]}}