मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग75k · #3067

type-only-imports

यह क्या करती है

यह स्किल TypeScript import statements जाँचती है और सिर्फ़ types वाले imports को सही तरीके से चिह्नित करती है। यह उन डेवलपर्स के लिए है जो छोटे bundles और कम dependency समस्याएँ चाहते हैं।

कब इस्तेमाल करें

  • ✓जब किसी TypeScript फ़ाइल में ऐसे modules import हों जो सिर्फ़ types के रूप में इस्तेमाल होते हैं।
  • ✓जब bundle में ऐसे modules हों जो शायद सिर्फ़ types के लिए लिए गए हैं।
  • ✓जब नया TypeScript प्रोजेक्ट साफ़ import नियमों के साथ सेट हो रहा हो।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/type-only-imports/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरा TypeScript build एक बड़ा module खींच रहा है जिसे मैं सिर्फ़ types के लिए इस्तेमाल करता हूँ। क्या आप imports ठीक कर सकते हैं?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट ऐसे imports खोजता है जो सिर्फ़ types के रूप में इस्तेमाल होते हैं और उन्हें import type में बदलता है। फिर कंपाइलर कोड build होने पर उन्हें हटा देता है।

तकनीकी सामग्री (मूल 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 क्या करता है?

यह कंपाइलर को बताता है कि यह import build के समय हटा दिया जाता है, इसलिए कोई runtime module लोड नहीं होता।

verbatimModuleSyntax क्या है?

स्किल के अनुसार यह TypeScript 5 की एक सेटिंग है जो यह नियम अपने-आप लागू करती है।

क्या यह circular dependencies में मदद कर सकता है?

स्किल कहती है कि सिर्फ़ types वाले imports से टाले जा सकने वाले circular dependencies कम हो सकते हैं।

जानकारी

लेखक का मूल विवरण

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
अपडेट की गई
31/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills