IliaIdakiev / angular-material-timepicker

Angular Material Timepicker Input for Template and Reactive forms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 8 An accessor cannot be declare d in an ambient context.

cberenguer opened this issue · comments

I am working in a project that is in angular 8 and i want to use this component but in the console i have this error and in the view the component appearce but the interface is broken:

ERROR in node_modules/mat-timepicker/lib/timepicker-dialog/timepicker-dialog.component.d.ts(20,9): error TS1086: An accessor cannot be declare
d in an ambient context.
node_modules/mat-timepicker/lib/timepicker-dialog/timepicker-dialog.component.d.ts(21,9): error TS1086: An accessor cannot be declared in an a
mbient context.
node_modules/mat-timepicker/lib/timepicker-dialog/timepicker-dialog.component.d.ts(38,9): error TS1086: An accessor cannot be declared in an a
mbient context.
node_modules/mat-timepicker/lib/timepicker-dialog/timepicker-dialog.component.d.ts(39,9): error TS1086: An accessor cannot be declared in an a
mbient context.
node_modules/mat-timepicker/lib/timepicker-dialog/timepicker-dialog.component.d.ts(40,9): error TS1086: An accessor cannot be declared in an a
mbient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(30,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(31,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(32,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(34,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(35,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(37,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(38,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(43,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(46,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(47,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(49,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(50,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(80,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(81,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(82,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(83,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/mat-timepicker/lib/timepicker.directive.d.ts(84,17): error TS1086: An accessor cannot be declared in an ambient context.

You can help me with this please, thanks.

Hello @cberenguer. I believe that this issue is caused because you are trying to install the latest version of this module into a project that doesn't support the new rendering engine (Ivy is by default the new rendering engine from Angular 9+). The solution is to install an earlier version of the module but then some of the bug fixes and newly added functionalities won't be available or to upgrade your Angular to at least version 9.

You can check out issue #15 related to the Angular 9 support. If you install a version before this it should work in your project but if possible it would be better to upgrade to 9+

Hello, thanks for responding so quickly, I already suspected that it was a problem with the version of angular, I tried with version 4 and it showed me the same error then I tried with version 3.0.3, but when I put the label as it was not imported but according to the documentation of npmjs.com it is not necessary to import anything, if you have any documentation of that version that can help me I would appreciate it, thanks

@cberenguer if you are still struggling with this problem you can send be a stackblitz so I can try to help you out.