NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.88k stars 3.94k forks source link

nzGutter Type in GridConfig in NzConfig appears to be incorrect #4870

Closed cparkinsonMYCM closed 4 years ago

cparkinsonMYCM commented 4 years ago

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-start-js3xtj?file=src/app/app.module.ts

Steps to reproduce

Set Grid's nzGutter property in Global Config with object as defined in documentation here e.g.

grid: { nzGutter: { xs: 8, sm: 16, md: 24, lg: 32, xl: 32, xxl: 32 } }

results in

Type '{ xs: number; sm: number; md: number; lg: number; xl: number; xxl: number; }' is not assignable to type 'number | BreakpointMap'.

However type should likely be

{ [key in NzBreakpoint]?: number;  } | number;

What is expected?

Type that is specified in documentation to be accepted as correct when setting global config for Grid Gutter

What is actually happening?

Typings are incorrect and wrong type is expected for Grid Gutter global config.

Environment Info
ng-zorro-antd 8.5.2
Browser Chrome Version 80.0.3987.132
vthinkxie commented 4 years ago

cc @wendellhu95 it seems that the nzGutter is not supported in the globalconfig yet.

wzhudev commented 4 years ago

@vthinkxie OMG. grid is even not a key of NzConfig. There must be a 👻

cparkinsonMYCM commented 4 years ago

It was there at the time when I opened the issue 😢

wzhudev commented 4 years ago

@cparkinsonMYCM Maybe we accidentally leak it into the config.ts file... Actually we didn't plan to support the Grid component in the configuration system, because you may have to write the layout just once or twice in one application.

wzhudev commented 4 years ago

@cparkinsonMYCM Maybe we accidentally leak it into the config.ts file... Actually we didn't plan to support the Grid component in the configuration system, because you may have to write the layout once or twice in one application.

vthinkxie commented 4 years ago

Hi @cparkinsonMYCM we are going to close this issue now, thanks for your reporting.