TypeScript में प्रकार एनोटेशन की कमी के कारण "this" का प्रकार "any" है
नमस्ते! मैंने TypeScript सीखना शुरू किया है और एक ऐसी त्रुटि का सामना किया है जिसे मैं ठीक नहीं कर पा रहा हूँ। मेरे पास एक सरल क्लास है जो कार्यों की सूची प्रबंधित करती है:\n\n```typescript\nclass TaskList {\n tasks: string[] = [];\n\n addTask(task: string) {\n this.tasks.push(task);\n console.log(`Added: ${task}`);\n }\n\n printTasks() {\n this.tasks.forEach(function(task) {\n console.log(`${task} - added by ${this.name}`);\n });\n }\n}\n\nconst myList = new TaskList();\nmyList.addTask("Learn TypeScript");\nmyList.printTasks();\n```\n\nजब मैं इस कोड को कंपाइल करता हूँ, तो मुझे यह त्रुटि मिलती है:\n\n```\n'this' implicitly has type 'any' because it does not have a type annotation\n```\n\nयह त्रुटि `forEach` मेथड के अंदर `console.log(`${task} - added by ${this.name}`);` लाइन पर इंगित करती है। मैं समझता हूँ कि `t