본문으로 건너뛰기
Skillpedia
일반 코딩75k · #3067

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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.

repo: thedaviddias/Front-End-Checklist

인기도

GitHub 스타
75k
순위
#3067
라이선스
MIT
업데이트
2026. 10. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬