ng-zorro-antd icon indicating copy to clipboard operation
ng-zorro-antd copied to clipboard

NzDrawerComponent Type Definition error

Open merih-sakarya opened this issue 1 year ago • 2 comments

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-ivy-kotjtq

Steps to reproduce

I am upgrading to version 14. However, the Drawer Component gives an error during the build.

What is expected?

Property 'nzContentParams' in type 'NzDrawerComponent<T, R, D>' is not assignable to the same property in base type 'NzDrawerOptionsOfComponent<any, any>'.

What is actually happening?

Error: node_modules/ng-zorro-antd/drawer/drawer.component.d.ts:73:5 - error TS2416: Property 'nzContentParams' in type 'NzDrawerComponent<T, R, D>' is not assignable to the same property in base type 'NzDrawerOptionsOfComponent<any, any>'.
  Type 'D | undefined' is not assignable to type 'Partial<any> | undefined'.
    Type 'D' is not assignable to type 'Partial<any> | undefined'.
      Type 'D' is not assignable to type 'Partial<any>'.

73     nzContentParams?: D;
       ~~~~~~~~~~~~~~~

  node_modules/ng-zorro-antd/drawer/drawer.component.d.ts:17:70
    17 export declare class NzDrawerComponent<T = NzSafeAny, R = NzSafeAny, D = NzSafeAny> extends NzDrawerRef<T, R> implements OnInit, OnDestroy, AfterViewInit, OnChanges, NzDrawerOptionsOfComponent {
                                                                            ~~~~~~~~~~~~~
    This type parameter might need an `extends Partial<any>` constraint.
  node_modules/ng-zorro-antd/drawer/drawer.component.d.ts:17:70
    17 export declare class NzDrawerComponent<T = NzSafeAny, R = NzSafeAny, D = NzSafeAny> extends NzDrawerRef<T, R> implements OnInit, OnDestroy, AfterViewInit, OnChanges, NzDrawerOptionsOfComponent {
                                                                            ~~~~~~~~~~~~~
    This type parameter might need an `extends Partial<any> | undefined` constraint.
Environment Info
ng-zorro-antd 14.0.0
Browser Chrome

merih-sakarya avatar Aug 31 '22 10:08 merih-sakarya

Downgrading TypeScript version from 4.8.2 to 4.7.2 fixed the issue

merih-sakarya avatar Aug 31 '22 10:08 merih-sakarya

Yes. I confirm that NzDrawerComponent has this error with TypeScript version 4.8.2.

seytzhan avatar Sep 08 '22 11:09 seytzhan

I also run into this problem.

pburgmer avatar Oct 13 '22 16:10 pburgmer

We do also have this problem with typescript 4.8.2

Stychlok avatar Oct 13 '22 16:10 Stychlok

Same problem here with Typescript 4.8.4

micobarac avatar Oct 30 '22 11:10 micobarac

Hey :) this pull request here will fix this problem :)

Nicoss54 avatar Dec 01 '22 23:12 Nicoss54