Avatar ·

TypeScript में ES2015 मॉड्यूल का उपयोग करते समय त्रुटि "requires an imported helper but module 'tslib' cannot be found"

सभी को नमस्ते! मैं TypeScript में नया हूँ और एक प्रोजेक्ट सेट अप करने की कोशिश कर रहा हूँ। मेरे पास इस कोड के साथ एक सरल index.ts फ़ाइल है:\n\n```typescript\nclass User {\n constructor(public name: string, public age: number) {}\n \n greet() {\n return `Привет, меня зовут ${this.name}`;\n }\n}\n\nconst user = new User("Анна", 25);\nconsole.log(user.greet());\n```\n\nमेरे tsconfig.json में मैंने यह निर्दिष्ट किया है:\n\n```json\n{\n "compilerOptions": {\n "target": "ES5",\n "module": "ES2015",\n "outDir": "./dist",\n "strict": true\n }\n}\n```\n\nजब मैं `tsc` के माध्यम से कंपाइलेशन चलाता हूँ, तो मुझे यह त्रुटि मिलती है:\n\n```\nerror TS2802: This syntax requires an imported helper but module 'tslib' cannot be found.\n```\n\nमैंने इस त्रुटि के बारे में गूगल किया, लेकिन मुझे पूरी तरह से समझ नहीं आया कि "imported helper" का क्या मतलब है और क

अभी तक कोई उत्तर नहीं।

लॉग इन करें उत्तर देने के लिए

ब्लॉग