Avatar ·

خطأ "requires an imported helper but module 'tslib' cannot be found" عند استخدام وحدات ES2015 في TypeScript

مرحباً بالجميع! أنا جديد في TypeScript وأحاول إعداد مشروع. لدي ملف بسيط index.ts بهذا الكود: ```typescript class User { constructor(public name: string, public age: number) {} greet() { return `مرحباً، اسمي ${this.name}`; } } const user = new User("آنا", 25); console.log(user.greet()); ``` في ملف tsconfig.json الخاص بي، قمت بتعيين: ```json { "compilerOptions": { "target": "ES5", "module": "ES2015", "outDir": "./dist", "strict": true } } ``` عند تشغيل التجميع عبر `tsc`، أحصل على الخطأ: ``` error TS2802: This syntax requires an imported helper but module 'tslib' cannot be found. ``` لقد بحثت عن هذا الخطأ على Google، لكنني لم أفهم تماماً ما يعنيه "imported helper" وما هو الحل.