type-only-imports
하는 일
이 스킬은 TypeScript의 import 문을 확인하고 타입 전용 가져오기를 올바르게 표시합니다. 번들을 작게 하고 의존성 문제를 줄이려는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓TypeScript 파일이 타입으로만 쓰는 모듈을 가져올 때.
- ✓번들에 타입 때문에만 들어온 것처럼 보이는 모듈이 있을 때.
- ✓깔끔한 가져오기 규칙으로 새 TypeScript 프로젝트를 설정할 때.
스킬 링크
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/type-only-imports/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“TypeScript 빌드에 타입 용도로만 쓰는 큰 모듈이 들어갑니다. 가져오기를 고쳐 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 타입으로만 쓰이는 가져오기를 찾아 import type으로 바꿉니다. 그러면 빌드할 때 컴파일러가 이 가져오기를 제거합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
import type은 무엇을 하나요?
컴파일러에게 이 가져오기는 빌드할 때 지워진다고 알려 주므로, 실행 시점에 모듈이 불러와지지 않습니다.
verbatimModuleSyntax란 무엇인가요?
이 스킬에 따르면 TypeScript 5의 설정으로, 이 규칙을 자동으로 강제합니다.
순환 의존성에도 도움이 되나요?
이 스킬은 타입 전용 가져오기를 쓰면 피할 수 있는 순환 의존성을 줄일 수 있다고 말합니다.
상세 정보
작성자의 원본 설명
Use when auditing import statements in TypeScript files, setting up a new TypeScript project, or investigating unexpected bundle inclusions from type-only dependencies.
인기도
- GitHub 스타
- 75k
- 순위
- #3067
- 라이선스
- MIT
- 업데이트
- 2026. 10. 31.
댓글
- …
이 저장소의 다른 스킬
frontendchecklist
75k명령줄 도구를 사용해 380개가 넘는 규칙으로 프런트엔드 코드와 실시간 페이지를 접근성, 속도, SEO, 보안 측면에서 점검합니다.
frontend-checklist-global
75kFront-End Checklist의 386개 규칙 전체로 프런트엔드 프로젝트를 감사하고, 발견한 문제마다 구체적인 해결 방법을 제시합니다.
404-page
75k없는 페이지 화면에 도움이 되는 링크가 있고 실제 404 상태 코드를 반환하는지 확인해, 길을 잃은 방문자를 돕습니다.
about-page
75k사이트를 운영하는 사람을 설명하는 명확한 소개 페이지가 있는지 검토해, 방문자와 검색 엔진의 신뢰를 높입니다.