Skip to content

[Grid Lite] IgxGridLiteColumnConfiguration requires explicit generic type and cannot be inferred #16962

@MarielaTihova

Description

@MarielaTihova

Description

IgxGridLiteColumnConfiguration is defined as a generic type, requiring an explicit model type (e.g. IgxGridLiteColumnConfiguration<ProductInfo>).
Using the type without a generic argument (IgxGridLiteColumnConfiguration[]) results in a TypeScript error, even when the grid data and columns clearly target a single known data model.

  • igniteui-angular version: ^21.1.0-rc.1
  • browser: Chrome

Steps to reproduce

  1. Define your columns list like this
  public columns: IgxGridLiteColumnConfiguration[] = [
        { field: 'id', header: 'ID', hidden: true, resizable: true, sortable: false, filterable: false, dataType: 'string'},
        { field: 'name', header: 'Product Name', hidden: false, resizable: true, sortable: false, filterable: false, dataType: 'string'},
        { field: 'price', header: 'Price', hidden: false, resizable: true, sortable: false, filterable: false, dataType: 'number' },
        { field: 'sold', header: 'Units sold', hidden: false, resizable: true, sortable: false, filterable: false, dataType: 'number' },
        { field: 'total', header: 'Total sold', hidden: false, resizable: true, sortable: false, filterable: false, dataType: 'number' },
        { field: 'rating', header: 'Customer rating', hidden: false, resizable: true, sortable: false, filterable: false, dataType: 'number' }
    ];
  1. Use the respective properties in your grid
 <igx-grid-lite-column [field]="col.field" [header]="col.header" [hidden]="col.hidden"
            [dataType]="col.dataType"> </igx-grid-lite-column>
  1. Save and see the console. The following issue appears:
[ERROR] TS2322: Type 'string | number | symbol' is not assignable to type 'Keys<{ [x: string]: {}; }>'.
  Type 'symbol' is not assignable to type 'Keys<{ [x: string]: {}; }>'. [plugin angular-compiler]
  1. When we give the columns list this type it works
columns: IgxGridLiteColumnConfiguration<ProductInfo>[]

Result

We are not able to use IgxGridLiteColumnConfiguration without specifying a generic type argument

Expected result

We should be able to use IgxGridLiteColumnConfiguration without specifying a generic type argument

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions