मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)75k · #2950

no-explicit-any

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

यह स्किल TypeScript फ़ाइलों में 'any' टाइप की जाँच करती है, जो टाइप चेकिंग को बंद कर देता है। यह उन डेवलपर्स के लिए है जो चाहते हैं कि उनका TypeScript ज़्यादा गलतियाँ जल्दी पकड़े।

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

  • ✓जब आप एजेंट से किसी TypeScript फ़ाइल की टाइप सुरक्षा समस्याएँ जाँचने को कहें।
  • ✓जब आपका linter 'any' टाइप पर चेतावनियाँ दिखाए और आप उन्हें सही तरह ठीक करना चाहें।
  • ✓जब कोई फ़ंक्शन ऐप के बाहर से आया डेटा संभाले और आप उसे इस्तेमाल से पहले जाँचना चाहें।

Skill का लिंक

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/no-explicit-any/SKILL.md

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

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

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

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

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

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

“क्या आप मेरी TypeScript फ़ाइलें देखकर 'any' टाइप को सुरक्षित टाइप से बदल सकते हैं?”

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

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

एजेंट 'any' के हर इस्तेमाल को खोजता है, जिसमें अप्रत्यक्ष और assert किए गए मामले भी हैं। वह 'unknown', generics या validation जैसे विकल्प सुझाता है, और हर मान के इस्तेमाल पर ज़रूरी जाँच दिखाता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Avoid the any type — use unknown, generics, or type guards instead

The any type is a local opt-out that becomes a global problem: a function returning any propagates unchecked types to every caller, silently undermining the type system across the entire codebase. Replacing any with unknown forces type narrowing at the point of use, turning latent runtime errors into compile-time failures where they are cheapest to fix.

Quick Reference

  • any disables all type checking for a value and cascades to callers
  • unknown is the safe alternative — it requires a type check before use
  • Use generics to express "I accept any type, but it stays consistent"
  • At API boundaries, validate with Zod rather than asserting with as Type

Check

Scan this TypeScript file for uses of the any type (explicit annotations, implicit any from missing types, and type assertions to any). Report each location and suggest a safer alternative.

Fix

Replace the any types in this code with unknown (for values of unknown shape), appropriate generics (for type-consistent operations), or Zod validation (for external data). Show the narrowing or generic constraint needed at each usage site.

Explain

Explain why the any type undermines TypeScript's guarantees, how unknown differs from any, and when a type assertion (as Type) is acceptable versus dangerous.

Code Review

Review all type annotations, function signatures, and external data handling in this file. Flag every explicit or implicit any, any type assertion that lacks a preceding type guard, and any return types inferred as any from untyped dependencies.


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

Rule page: https://frontendchecklist.io/rules/javascript/no-explicit-any

अक्सर पूछे जाने वाले सवाल

'any' और 'unknown' में क्या अंतर है?

'any' सारी जाँच पूरी तरह बंद कर देता है, जबकि 'unknown' के मान को इस्तेमाल से पहले टाइप जाँच की ज़रूरत होती है।

क्या टाइप assertion कभी ठीक है?

स्किल कहती है कि कुछ मामलों में यह ठीक हो सकता है, पर असली समस्या छिपाने के लिए इस्तेमाल हो तो यह खतरनाक है।

ऐप की सीमाओं पर बाहरी डेटा क्यों जाँचें?

स्किल सुझाती है कि बाहरी डेटा को Zod जैसी validation लाइब्रेरी से जाँचें, न कि उसका टाइप assert करें।

जानकारी

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

Use when reviewing TypeScript files for type safety regressions, during code review of functions that handle external data, or when the codebase has ESLint warnings for @typescript-eslint/no-explicit-any.

repo: thedaviddias/Front-End-Checklist

लोकप्रियता

GitHub स्टार
75k
रैंकिंग में स्थान
#2950
लाइसेंस
MIT
अपडेट की गई
31/10/2026

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

0

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

कमेंट

  • …

इस repository की और skills

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