Angular 5 和 FullCalendar 的打字稿错误



我按照 fullcalendar 和 Angular 5 中给出的所有步骤使用 Angular 5 项目设置 FullCalendar(新项目,ng new后没有添加任何其他内容(

尝试运行ng serve命令时,我收到以下错误(以及更多(

ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-03-05T14:44:41.420Z
Hash: 33eefe59976d9e67375d
Time: 3084ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.91 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 577 bytes [initial] [rendered]
chunk {scripts} scripts.bundle.js (scripts) 456 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 113 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 852 kB [initial] [rendered]
ERROR in node_modules/fullcalendar- scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(60,15): error TS2451: Cannot redeclare block-scoped variable 'dayIDs'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(61,15): error TS2451: Cannot redeclare block-scoped variable 'unitsDesc'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(94,15): error TS2300: Duplicate identifier 'Default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(98,2): error TS2300: Duplicate identifier 'default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(110,15): error TS2300: Duplicate identifier 'Default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(119,2): error TS2300: Duplicate identifier 'default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(123,15): error TS2300: Duplicate identifier 'Default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(142,2): error TS2300: Duplicate identifier 'default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(146,15): error TS2300: Duplicate identifier 'Default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(160,2): error TS2300: Duplicate identifier 'default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(163,15): error TS2451: Cannot redeclare block-scoped variable 'globalDefaults'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(223,15): error TS2451: Cannot redeclare block-scoped variable 'englishDefaults'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(226,15): error TS2451: Cannot redeclare block-scoped variable 'rtlDefaults'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(248,15): error TS2300: Duplicate identifier 'Default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(253,2): error TS2300: Duplicate identifier 'default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(261,15): error TS2300: Duplicate identifier 'Default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(267,2): error TS2300: Duplicate identifier 'default'.
node_modules/fullcalendar-scheduler/node_modules/fullcalendar/dist/fullcalendar.d.ts(272,15): error TS2300: Duplicate identifier 'Default'.

我错过了什么以及如何解决这些Duplicate identifier错误?

package.json 文件中的完整日历调度程序版本前面可能有一些 ~ 或 ^ 符号,这些符号可能会安装与机器中安装的 fullcalender 不兼容的版本。因此,请在packag.json文件中为fullcalendar-scheduler指定确切的兼容版本,并确保安装的版本与我们在package.json文件中使用npm list命令指定的版本相同。

删除全日历计划可以解决此问题。Fullcalendar-scheduledular 的依赖项中也有 fullcalendar,这导致了问题。

只设置设置"skipLibCheck":在tsconfig.json中为真,这解决了我的问题。祝你好运。

"compilerOptions": {
    "skipLibCheck": true
}

相关内容

  • 没有找到相关文章

最新更新