Skip to content

Incorrect typings of mdl table #595

@ghost

Description

I have a compile error when using addAll method of MdlDefaultTableModel using Typescript 2.0.6. Here's the code:

const tableData = this.events.map(event => Object.assign({}, event, { selected: false }));
this.tableModel.addAll(tableData);

This gives me the following error:
Error:(53, 28) TS2345:Argument of type '({} & Event & { selected: boolean; })[]' is not assignable to parameter of type '[IMdlTableModelItem]'. Property '0' is missing in type '({} & Event & { selected: boolean; })[]'.

If you look at addAll method in node_modules/angular2-mdl/components/table/mdl-table.component.d.ts you'll see that its parameter data has strange type signature:
addAll(data: [IMdlTableModelItem]): void;

If you change it to the following signature it will work:
addAll(data: IMdlTableModelItem[]): void;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions