Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with CalendarEvent typing #221

Closed
mgween opened this issue May 30, 2017 · 14 comments
Closed

Problem with CalendarEvent typing #221

mgween opened this issue May 30, 2017 · 14 comments

Comments

@mgween
Copy link

mgween commented May 30, 2017

Bug description / Feature request:

These are all of the steps I took up to the issue arising. Starting from creation of the project.

ng new calendar-test
cd calendar-test
npm install --save angular-calendar
At this point I noticed NPM gave me the warning UNMET PEER DEPENDENCY @angular/animations@^4.0.0, so I ran npm install --save @angular/animations

Then I added

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { CalendarModule } from 'angular-calendar';

...

imports: [ BrowserAnimationsModule, CalendarModule.forRoot() ]

to my app.module.ts and then ran ng serve.

Upon running ng serve I get a failure to compile with the following error:

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (20,41): ',' expected.

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (17,16): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (20,43): Type parameter name cannot be 'any'

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (36,12): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (47,13): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (58,12): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (69,19): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (80,12): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (92,14): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (101,14): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/calendar-utils/dist/calendarUtils.d.ts (110,14): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/providers/calendarEventTitleFormatter.provider.d.ts (27,18): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/providers/calendarEventTitleFormatter.provider.d.ts (31,25): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/providers/calendarEventTitleFormatter.provider.d.ts (35,17): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/providers/calendarEventTitleFormatter.provider.d.ts (39,24): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/providers/calendarEventTitleFormatter.provider.d.ts (43,16): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/providers/calendarEventTitleFormatter.provider.d.ts (47,23): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/interfaces/calendarEventTimesChangedEvent.interface.d.ts (6,12): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/day/calendarDayView.component.d.ts (28,13): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/day/calendarDayView.component.d.ts (90,16): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/day/calendarDayView.component.d.ts (152,21): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/month/calendarMonthView.component.d.ts (27,13): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/month/calendarMonthView.component.d.ts (79,16): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/month/calendarMonthView.component.d.ts (124,31): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/month/calendarMonthView.component.d.ts (128,44): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/week/calendarWeekView.component.d.ts (28,13): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in C:/Users/Matt/dev/tests/calendar-test/node_modules/angular-calendar/dist/esm/src/components/week/calendarWeekView.component.d.ts (76,16): Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

ERROR in multi ./src/styles.css ./src/~/angular-calendar/dist/css/angular-calendar.css
Module not found: Error: Can't resolve 'C:\Users\Matt\dev\tests\calendar-test\src\node_modules\angular-calendar\dist\css\angular-calendar.css' in 'C:\Users\Matt\dev\tests\calendar-test'
 @ multi ./src/styles.css ./src/~/angular-calendar/dist/css/angular-calendar.css

For bugs only, a link to minimally working plunker that reproduces the issue (you can fork a starter from any of the demos)

Is a plunkr necessary for an issue that arises so early in the bootstrapping process? If so, please let me know and I will try to provide one.

Versions

Angular: 4.1.3

Calendar library: 0.17.0

Browser name and version: N/A

@etwillbefine
Copy link
Collaborator

etwillbefine commented May 30, 2017

This relates to #218 and it only happens to you because you upgraded to the latest version.
Im not sure if we continue with the generic approach or not. /cc @mattlewis92 ?
Anyway the required second generic type (any) is wrong indeed.

To make it work again, downgrade to Version 0.16.0 or specify the required generic type CalendarEvent<Type>

@mattlewis92
Copy link
Owner

Ah, it seems like generic defaults are only for TS 2.3, IIRC the cli ships with 2.2 by default. If you upgrade typescript to 2.3.x does the problem go away?

@mgween
Copy link
Author

mgween commented May 30, 2017

Upgrading the typescript dependency from "~2.2.0" to "~2.3.0" did seem to solve it.

@mgween mgween closed this as completed May 30, 2017
@mgween
Copy link
Author

mgween commented May 31, 2017

Just a note:
By upgrading the typescript version to 2.3.x, the code will compile, but my Atom typescript package (and probably a lot of other tooling as well) will complain about it with: Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

@mattlewis92
Copy link
Owner

Ah it seems like atom-typescript has a hard dependency on an older nightly version of typescript that doesn't have generic defaults. I think it might just be best to revert this for now and give it a few months for tooling to catch up.

@jaripekkala
Copy link

I also needed upgrade @angular/cli to version ^1.1.0 to get rid of the errors.

@jsitu
Copy link

jsitu commented Jun 8, 2017

Upgraded @angular/cli and typescript as mentioned above don't seem to work in my cases.

@sascha1337
Copy link

npm install --save-dev typescript@latest

This fixed the error for me.

@mattlewis92
Copy link
Owner

Changed my mind on this, I've added an explicit peer dependency on typescript 2.3 so folks should get warned when they're using an older version when updating the package. I also sent a PR to the atom typescript package to update its TS dependency: TypeStrong/atom-typescript#1272

@Dazag
Copy link

Dazag commented Jun 15, 2017

It seems like it's not a Atom thing only. I am using PHPStorm I have literally just installed the package, and updated typescript and angular/cli to final version. Both in global and locally. Could it be happening in phpStorm too? It doesn't recognize the use of generic defaults. Is there something I can do to make it work until all technology catch up?

thanks!

@mattlewis92
Copy link
Owner

It works ok for me in webstorm, I didn't think that php storm even supported typescript?

@etwillbefine
Copy link
Collaborator

It does but if generics are not supported in general, it seems to be related to your configuration. There is a bundled typescript version in PHPStorm (have you checked this in preferences -> languages & frameworks -> typescript -> typescript version ?). Try using the version from node_modules instead? You need at least 2.3 version configured

@Dazag
Copy link

Dazag commented Jun 16, 2017

I just typed again yarn remove angular-calendar && yarn add angular-calendar, and now it seems to recognize the default generics!
Well I guess that was the last step missing, even though, it didn't make sense to me, that I had typescript 2.3.4, globally installed and locally but phpStorm wasn't applying the right typescript version in compilaiton...

@naibedya
Copy link

naibedya commented Oct 24, 2017

I am still getting the below error with my ts dependencies : "^2.5.3"
Build:Generic type 'CalendarEvent<MetaType, any>' requires 2 type argument(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants