type-coercion
यह क्या करती है
यह स्किल JavaScript कोड में ऐसी तुलनाएँ और रूपांतरण देखती है जो चौंकाने वाले नतीजे दे सकते हैं। यह उन डेवलपर्स के लिए है जो छिपे बग कम करना चाहते हैं।
कब इस्तेमाल करें
- ✓जब JavaScript कोड में सख़्त तुलना की जगह == या != इस्तेमाल हो।
- ✓जब टेक्स्ट और संख्याओं को ऐसे तरीके से जोड़ा जाए जो आपस में मिल जाएँ।
- ✓जब कोड समीक्षा में किसी स्क्रिप्ट में type संभालने का साफ़ तरीका माँगा गया हो।
Skill का लिंक
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/type-coercion/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरा JavaScript कभी-कभी मानों की गलत तुलना करता है। क्या आप ढीली तुलनाएँ खोजकर उन्हें सख़्त बना सकते हैं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट ढीली बराबरी वाली जाँच और जोखिम भरे मिश्रित-type ऑपरेशन खोजता है। उन्हें वह सख़्त तुलना और साफ़ रूपांतरण से बदलता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Avoid implicit type coercion
JavaScript's implicit type coercion produces results that look like bugs to anyone who doesn't know the exact coercion rules. == comparisons with mixed types silently convert values in ways that fail to catch genuine errors. Explicit conversions make code intent clear and catch real type mismatches at the point where they occur.
Quick Reference
- Always use === and !== instead of == and !=
- Convert types explicitly with Number(), String(), Boolean(), parseInt()
- Be careful with + operator — it concatenates strings but adds numbers
- Use Array.isArray() instead of typeof for array checks
Check
Find all uses of == and != (non-strict equality) in this file. Also look for implicit type conversions from + operator and other coercion traps.
Fix
Replace all == with === and != with !==. Add explicit type conversions where mixed types are intentionally compared.
Explain
Explain JavaScript's implicit type coercion rules, why == is problematic, and how to write safe type comparisons.
Code Review
Review scripts, client components, and browser execution paths related to Avoid implicit type coercion. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/javascript/type-coercion
अक्सर पूछे जाने वाले सवाल
== क्यों समस्या है?
तुलना से पहले यह मानों को अपने-आप बदल देता है, जिससे असली गलतियाँ छिप सकती हैं और नतीजे अनुमान से बाहर हो सकते हैं।
arrays की जाँच का सुरक्षित तरीका क्या है?
स्किल arrays जाँचने के लिए typeof की जगह Array.isArray() सुझाती है।
type कैसे बदलने चाहिए?
Number(), String(), Boolean() या parseInt() जैसे साफ़ फ़ंक्शन इस्तेमाल करें।
जानकारी
लेखक का मूल विवरण
Use when reviewing scripts, client components, bundles, or runtime behavior related to Avoid implicit type coercion. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.
लोकप्रियता
- GitHub स्टार
- 75k
- रैंकिंग में स्थान
- #3066
- लाइसेंस
- MIT
- अपडेट की गई
- 31/10/2026
कमेंट
- …
इस repository की और skills
frontendchecklist
75kकमांड-लाइन टूल से फ़्रंटएंड कोड और लाइव पेजों को एक्सेसिबिलिटी, स्पीड, SEO और सिक्योरिटी के 380 से ज़्यादा नियमों से जाँचती है।
frontend-checklist-global
75kफ़्रंटएंड प्रोजेक्ट को Front-End Checklist के सभी 386 नियमों से ऑडिट करती है, और हर मिली समस्या का ठोस समाधान देती है।
404-page
75kजाँचती है कि आपका गुम पेज उपयोगी लिंक देता है और सही 404 स्टेटस लौटाता है, ताकि भटके हुए विज़िटर रास्ता ढूँढ सकें।
about-page
75kजाँचती है कि आपकी साइट पर एक साफ़ About पेज है जो बताता है कि उसे कौन चलाता है, ताकि विज़िटर और सर्च इंजन का भरोसा बढ़े।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।