Angle 6中的事件日历问题

时间:2019-09-24 04:49:41

标签: angular angular6

我正在使用angular 6中的angular-calendar库创建事件日历。它可以正常工作,但是当我构建项目时,它会显示一些错误并导致构建过程失败。

"private": true,
"dependencies": {
"@angular/animations": "^6.1.10",
"@angular/cdk": "^6.4.7",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/material": "^6.4.7",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.1.3",
"angular-calendar": "^0.27.18",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"date-fns": "^1.30.1",
"google-libphonenumber": "^3.2.2",
"hls.js": "^0.12.4",
"intl-tel-input": "^15.1.0",
"mydatepicker": "^2.6.6",
"ng-pick-datetime": "^6.0.16",
"ngx-bootstrap": "^3.3.0",
"ngx-drag-scroll": "^7.4.3",
"ngx-image-cropper": "^1.4.1",
"ngx-intl-tel-input": "^2.1.1",
"rxjs": "~6.2.0",
"rxjs-compat": "^6.5.2",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.8.0",
"@angular/cli": "~6.2.9",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "^2.9.2"
}

在应用模块中。ts

import { CalendarModule, DateAdapter } from 'angular-calendar';
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';

在component.ts

import {startOfDay, endOfDay, subDays, addDays, endOfMonth, isSameDay, isSameMonth, addHours} from 'date-fns';
import { Subject } from 'rxjs';
import { CalendarEvent, CalendarEventAction, CalendarEventTimesChangedEvent, CalendarView} from 'angular-calendar';

const colors: any = {
  red: {
  primary: '#ad2121',
secondary: '#FAE3E3'
},
blue: {
primary: '#1e90ff',
secondary: '#D1E8FF'
},
yellow: {
primary: '#e3bc08',
secondary: '#FDF1BA'
}
};
viewDate: Date = new Date();
events: CalendarEvent[] = [];

在component.html

"`<mwl-calendar-month-view
[viewDate]="viewDate"
[events]="events"
(eventClicked)="handleEvent($event.event)"
(dayClicked)="dayClicked($event.day)">
</mwl-calendar-month-view>`"

错误是-

ERROR in ./node_modules/angular-calendar/fesm5/angular-calendar.js
Module build failed (from ./node_modules/@angular-devkit/build- 
optimizer/src/build-optimizer/webpack-loader.js):
Error: Debug Failure. False expression.
at Object.assertDefined (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:4507:13)
at getJSDocHost (/home/mantech-pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:10547:25)
at getHostSignatureFromJSDoc (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:10533:46)
at Object.getParameterSymbolFromJSDoc (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:10524:20)
at checkJSDocParameterTag (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:47154:21)
at checkSourceElement (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:49806:28)
at Object.forEach (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:1792:30)
at checkSourceElement (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:49738:24)
at Object.forEach (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:1792:30)
at checkBlock (/home/mantech-pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:47525:20)
at checkSourceElement (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:49831:28)
at checkIfStatement (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:47912:13)
at checkSourceElement (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:49837:28)
at Object.forEach (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:1792:30)
at checkSourceFileWorker (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:50023:20)
at checkSourceFile (/home/mantech- 
pc/Santanu/m_lyk_route_change/lyk- 
mobile/node_modules/typescript/lib/typescript.js:49991:13)

请有人帮我解决这个问题。我该如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

更新您的打字稿,这将是您的解决方案。

npm install typescript

请告诉我是否对您有帮助