Closed kpredde closed 1 year ago
Hello @haavardj
I have the same issue as @kpredde. I am using Anglar version 14.2.10 After installing latest version 0.7.6 I have the same issue when trying to display the cron editor in my project
Error: node_modules/ngx-cron-editor/src/cron-editor.component.d.ts:84:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.
|
| 84 static ɵcmp: i0.ɵɵComponentDeclaration<CronGenComponent, "cron-editor", never, { "backgroundColor": "backgroundColor"; "color": "color"; "disabled": "disabled"; "options": "options"; "cron": "cron"; }, { "cronChange": "cronChange"; }, never, never, false, never>;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| Error: node_modules/ngx-cron-editor/src/cron-time-picker.component.d.ts:22:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.
|
| 22 static ɵcmp: i0.ɵɵComponentDeclaration<TimePickerComponent, "cron-time-picker", never, { "disabled": "disabled"; "use24HourTime": "use24HourTime"; "hideHours": "hideHours"; "hideMinutes": "hideMinutes"; "hideSeconds": "hideSeconds"; }, {}, never, never, false, never>;
Can you please help us if you have any clue? Many thanks,
Found the solution:
The latest version requires Angular 15 and it is not retro compatible. Since my project is on Angular 14 I installed an older version of the ngx-cron-editor 0.7.4 instead of 0.7.6
Here is the command that worked out for me: npm i ngx-cron-editor@0.7.4 --legacy-peer-deps
Great that it worked out. It is not easy to remain backward compatible with these frameworks :-( I always end up updating to the latest version of everything.
Found the solution:
The latest version requires Angular 15 and it is not retro compatible. Since my project is on Angular 14 I installed an older version of the ngx-cron-editor 0.7.4 instead of 0.7.6 Here is the command that worked out for me:
npm i ngx-cron-editor@0.7.4 --legacy-peer-deps
This worked for me too thanks @MoEffat
Installing the older version fixes the number of arguments issue. But the older versions have a bug where the initial expression isn't loaded, There's a new version out, ngx-cron-editor@0.7.9-0, that fixes the issue of the initial cron expression not being loaded, but again it has the number of arguments issue. Has anyone found a solution to the number of arguments issue that doesn't involve installing an older version?
I have seen the same ɵɵComponentDeclaration error in another project I worked on, and I ended up migrating that project to the latest Angular version. I don't have a fix at the moment, unfortunately. Keeping libraries backward compatible with older Angular versions seems to be a futile task, and I am not sure what the best strategy is here. Any suggestions you have are welcome.
Going forwards, I think we simply must simply remove anything but Angular 16 (and perhaps 15) as supported peer dependencies (from version 0.8). If time allows, we can try to revert 0.7 back to supporting Angular 12-14.
I'm still seeing this bug on Angular 15 with the latest version (0.7.9)
In the cron-time-picker-component, simply changing the line:
"static ɵcmp: i0.ɵɵComponentDeclaration<TimePickerComponent, "cron-time-picker", never, { "disabled": { "alias": "disabled"; "required": false; }; "use24HourTime": { "alias": "use24HourTime"; "required": false; }; "hideHours": { "alias": "hideHours"; "required": false; }; "hideMinutes": { "alias": "hideMinutes"; "required": false; }; "hideSeconds": { "alias": "hideSeconds"; "required": false; }; }, {}, never, never, false, never>;"
To:
" static ɵcmp: i0.ɵɵComponentDeclaration<TimePickerComponent, "cron-time-picker", never, { "disabled": "disabled"; "use24HourTime": "use24HourTime"; "hideHours": "hideHours"; "hideMinutes": "hideMinutes"; "hideSeconds": "hideSeconds"; }, {}, never, never, false, never>;
Fixes the issue. A similar thing can be done with the cron-editor.compinent.d.ts file, changing the line:
static ɵcmp: i0.ɵɵComponentDeclaration<CronGenComponent, "cron-editor", never, { "backgroundColor": { "alias": "backgroundColor"; "required": false; }; "color": { "alias": "color"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, {}, never, never, false, never>;
to:
static ɵcmp: i0.ɵɵComponentDeclaration<CronGenComponent, "cron-editor", never, { "backgroundColor": "backgroundColor"; "color": "color"; "disabled": "disabled"; "options": "options"; }, {}, never, never, false, never>;
After these two changes, the editor works fine.
However, it's still having the other bug reported, where the initial cron value is not loaded correctly.
After installing latest version 0.7.6, angular builds are failing with below issue
Error: node_modules/ngx-cron-editor/src/cron-editor.component.d.ts:84:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.
84 static ɵcmp: i0.ɵɵComponentDeclaration<CronGenComponent, "cron-editor", never, { "backgroundColor": "backgroundColor"; "color": "color"; "disabled": "disabled"; "options": "options"; "cron": "cron"; }, { "cronChange": "cronChange"; }, never, never, false, never>;