angular-material-components icon indicating copy to clipboard operation
angular-material-components copied to clipboard

Typescript issue: Type NgxMatDatetimePicker<any>' is not assignable to type 'MatDatepickerPanel<MatDatepickerControl<any>, any, any>

Open Mathilde-Frere opened this issue 4 years ago • 6 comments

Hi !

I tried to use your datetime picker component (version 7.0.1) with Angular 13.0.2 and Angular Material 13.0.2 But when I build my project library, I've got this error in my terminal :

projects/test-lib/src/lib/datetime-setting/datetime-setting.component.html:34:37 - error TS2322: Type 'NgxMatDatetimePicker<any>' is not assignable to type 'MatDatepickerPanel<MatDatepickerControl<any>, any, any>'.

     <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
                                       ~~~

  projects/test-lib/src/lib/datetime-setting/datetime-setting.component.ts:9:16
    templateUrl: './datetime-setting.component.html',

    Error occurs in the template of component DatetimeSettingComponent.

I have testing to use your component as the simple way as possible but I still have this error. And I have checking your code and I don't see where the issue could it be.

Does anyone else have this error?

Thanks a lot for your help !

Mathilde-Frere avatar Nov 29 '21 15:11 Mathilde-Frere

I got the same error, a other issue suggested this answer:

<mat-datepicker-toggle matSuffix [for]="$any(picker)">

JesperHonders avatar Nov 30 '21 12:11 JesperHonders

Thanks a lot @JesperHonders, it works well for me !

Mathilde-Frere avatar Nov 30 '21 12:11 Mathilde-Frere

It's ok, but this is not a solution. (It's ugly to use $any() on every time.) Please fix the types!

galfimihaly avatar Jun 30 '22 06:06 galfimihaly

I have the same problem. On the other hand I've never seen anything like $any(..) in many years of angular, ugly but nice to have.

victorbadila avatar Sep 21 '22 12:09 victorbadila

Thank you, it's save me !!!

Ombre2 avatar Nov 27 '22 18:11 Ombre2

I'm seeing the same issue; using $any(...) helped, but please fix the types!

kpeters-cbsi avatar Jun 12 '23 18:06 kpeters-cbsi