matheo / angular

Open Source Angular Libraries: MatDataSource, MatDatepicker
http://matheo.co/demos/
MIT License
60 stars 15 forks source link

Build error TS2720: Class 'MatDateRangeInput<D>' incorrectly implements class 'MatFormFieldControl<DateRange<D>>' #61

Closed sirockin closed 2 years ago

sirockin commented 2 years ago

I've imported the datepicker library into my Angular 13 project, as per the instructions and am receiving the following build error:

Error: node_modules/@matheo/datepicker/lib/date-range-input.d.ts:22:22 - error TS2720: Class 'MatDateRangeInput<D>' incorrectly implements class 'MatFormFieldControl<DateRange<D>>'. Did you mean to extend 'MatFormFieldControl<DateRange<D>>' and inherit its members as a subclass?
  Property 'ngModel' is missing in type 'MatDateRangeInput<D>' but required in type 'MatFormFieldControl<DateRange<D>>'.

22 export declare class MatDateRangeInput<D> implements MatFormFieldControl<DateRange<D>>, MatDatepickerControl<D>, MatDateRangeInputParent<D>, MatDateRangePickerInput<D>, AfterContentInit, OnChanges, OnDestroy {
                        ~~~~~~~~~~~~~~~~~

  node_modules/@angular/material/form-field/form-field-control.d.ts:14:5
    14     ngModel: T | null;
           ~~~~~~~
    'ngModel' is declared here.

✖ Failed to compile.

I have checked the declaration for abstract class MatFormFieldControl and confirmed that it does indeed declare ngModel as an input.

My angular imports are all v13 (including material), as shown in the package.json excerpt below:

"dependencies": {
    "@angular/animations": "^13.0.2",
    "@angular/cdk": "^13.0.2",
    "@angular/common": "^13.0.2",
    "@angular/compiler": "^13.0.2",
    "@angular/core": "^13.0.2",
    "@angular/flex-layout": "^13.0.0-beta.38",
    "@angular/forms": "^13.0.2",
    "@angular/localize": "^13.0.2",
    "@angular/material": "^13.0.2",
    "@angular/platform-browser": "^13.0.2",
    "@angular/platform-browser-dynamic": "^13.0.2",
    "@angular/router": "^13.0.2",
    "@angular/service-worker": "^13.0.2",
   ...
    "@matheo/datepicker": "^13.0.0-beta.1",
   ...
}

Any advice would be greatly appreciated!

sirockin commented 2 years ago

Updating to "@angular/material": "^13.3.9" fixes this.