ag grid - Typescript augmentation -
i've been trying unsuccessfully augment type in aggrid few new properties.
import * aggrid 'ag-grid/main'; declare module "ag-grid/main" { export interface coldef { format: string; unittype: string; } }
everything have tried results in original coldef being overwritten , build error of: export declaration conflicts exported declaration of 'coldef'
so figured out how this. problem cannot augment re-exported module. have directly import it.
import coldef 'ag-grid/dist/lib/entities/coldef'; // patch coldef interface allows add new properties it. declare module "ag-grid/dist/lib/entities/coldef" { interface coldef { format?: string; unittype?: string; } }
this apply library re-exports it's modules. in case of aggrid there main.d.ts exports modules other definition files export modules directly.
more info here. https://github.com/microsoft/typescript/issues/8427
wiki
Comments
Post a Comment