Devextreme-angular: Typescript type definitions

Created on 8 Mar 2018  路  6Comments  路  Source: DevExpress/devextreme-angular

  • Specify the version of the devextreme-angular and devextreme packages you are using.
    devexteme version: 17.2.5
    devextreme-angular version: 17.2.5
  • Specify the type of the issue (check one with "x"):
  • bug Report
  • feature request - X
  • support inquiry

Hi, I'm not sure if they already exist, but it would be neat for our Angular development to have access to the Typescript types definitions regarding the DevExtreme UI widgets. I didn't find what should be done in the current documentation to be able to use them if they already exist. Thanks!

enhancement

Most helpful comment

Any changes of heart for generating those?

All 6 comments

Which definitions exactly are you looking for?
You can already do the following:

import DataSource from 'devextreme/data/data_source';

import CustomStore from 'devextreme/data/custom_store';
import ODataStore from 'devextreme/data/odata/store';
import ArrayStore from 'devextreme/data/array_store';

And you'll get all the type checking and IDE auto-completion when using those classes.

@hakimio When I wrote initially this issue, I didn't check thoroughly the available types, but what about event handlers that are all shooting any objects? As for example, with dx-text-box, I may register an event handler for onValueChanged, but it will emit any as an object:

image

Perhaps, could the defined types receive some :heart: regarding that?

Hi @felpel !
I agree that this would be a great feature. But to support it, we need to generate named classes or interfaces for arguments of each event so that you can import TypeScript definitions for our event parameters to use them in your event handlers. At the moment, we don't have plans to generate them. But, we may do this in the future.

Any changes of heart for generating those?

Any updates on this? it would help me alot if i could have typed objects from devexpress, for example datasources, as an example last week the team i'm in changed the return type of a service removing a field and we had to do a "string" search for the damn thing, if all the objects were typed the project would not even transpile which would be awsome.

I would really like this too, it would give me a lot more confidence in the code I'm writing. One thing, for now, that can get us a part of the way there is to lookup the documentation for a particular event, like the dxDataGrid's toolbarPreparing event. The type of the event args is indeed just object, but the fields you expect to be there are listed, and one could define an inline interface (I couldn't find the actual name for this in TypeScript) like this:

  onToolbarPreparing(event: {
    component: DxDataGridComponent;
    element: HTMLElement;
    model: any;
    toolbarOptions: {...};
  }) {
    ...
  }

But having these types provided for us, again, would be huge :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cito picture Cito  路  5Comments

bonejon picture bonejon  路  4Comments

bjabbar picture bjabbar  路  5Comments

Angelminster picture Angelminster  路  6Comments

keserwan picture keserwan  路  9Comments