TypeScript में noImplicitAny फ्लैग के साथ "Index signature of object type implicitly has an 'any' type" एरर को कैसे ठीक करें
सभी को नमस्कार! मैं TypeScript में एक प्रोजेक्ट लिख रहा हूँ और `noImplicitAny` फ्लैग के साथ स्ट्रिक्ट मोड चालू किया है। अब मुझे एक समस्या आ रही है: जब मैं डायनामिक की के साथ ऑब्जेक्ट को एक्सेस करने की कोशिश करता हूँ, तो कंपाइलर यह एरर देता है:\n\n> Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '...'. No index signature with a parameter of type 'string' was found on type '...'.\n\nयहाँ मेरे कोड का उदाहरण है। मेरे पास विभिन्न ऑर्डर स्टेटस के लिए कलर कॉन्फ़िगरेशन का एक ऑब्जेक्ट है:\n\n```typescript\nconst statusColors = {\n pending: 'orange',\n confirmed: 'blue',\n shipped: 'green',\n cancelled: 'red'\n};\n\nfunction getStatusColor(status: string): string {\n return statusColors[status]; // ❌ एरर!\n}\n```\n\nमैं उम्मीद करता हूँ कि फंक्शन की के अनुसार कलर लौटाएगा, लेकिन TypeScript एरर देता है।