Angular 9: Cannot find namespace 'FullCalendarVDom'?

喜你入骨 提交于 2020-08-09 08:14:14

问题


I installed rrule plugin by running:

npm install @fullcalendar/rrule

but when I add its import to my component:

import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import rrulePlugin from '@fullcalendar/rrule';  //error appears after adding this import

I get this errors:

    node_modules/@fullcalendar/common/vdom.d.ts:16:28 - error TS2304: Cannot find name 'FullCalendarVDom'.
    
    16 export import flushToDom = FullCalendarVDom.flushToDom;
                                  ~~~~~~~~~~~~~~~~
    node_modules/@fullcalendar/common/vdom.d.ts:16:28 - error TS2503: Cannot find namespace 'FullCalendarVDom'.
    
    16 export import flushToDom = FullCalendarVDom.flushToDom;

Other plugin imports are working fine. Where is the problem?


回答1:


In case it's useful for anyone, here's what worked for me.

(Edit: I'm obviously using PrimeNG with Angular...)

In the xyz.component.html file:

<p-fullCalendar #calendar ...></p-fullCalendar>

In the xyz.component.ts file:

import {FullCalendar} from 'primeng/fullcalendar';

...

@ViewChild('calendar') private calendar: FullCalendar;

Didn't need to use the calendar field for anything, but this hack seems to get the imports in the right order. For some reason. Go figure.



来源:https://stackoverflow.com/questions/63037718/angular-9-cannot-find-namespace-fullcalendarvdom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!