DevExtreme icon indicating copy to clipboard operation
DevExtreme copied to clipboard

improve typescript typing

Open Bykiev opened this issue 3 years ago • 0 comments

Hi, to get the component in Angular the recommended way is casting component instance to specific type:

const popup = Popup.getInstance(popupElement) as Popup;

But in strict mode it will cause such error:

Conversion of type 'DOMComponent<Properties>' to type 'dxPopup<Properties>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

I believe it should be a better way than casting to unknown. It'll be better if getInsance method will return Popup instead of DomComponent<Properties>

Upd: with PivotGrid there is another error:

Type 'DOMComponent<Properties>' is missing the following properties from type 'dxPivotGrid': bindChart, exportToExcel, getDataSource, getFieldChooserPopup, and 4 more.

with DataGrid:

Type 'DOMComponent<Properties>' is missing the following properties from type 'dxDataGrid<any, any>': addColumn, addRow, clearGrouping, collapseAll, and 63 more.

Bykiev avatar Sep 13 '22 17:09 Bykiev