Hi,
Where can I obtain a typescript definition file, a single .d.ts file that contains all of the components definition/declaration?
Due to how I structure my application, which is by including the ej2.min.js from npm's dist folder, inside the main.html in a "script" tag. And I don't want to use import statement in my ts file, but I still wanted to have the type definitions of the component. The ej2.d.ts file did have all the types, but the definition are scattered across multiple files.
For other components/products like one from Bryntum, they provide this file. For Syncfusion, is the definition file available, to accommodate my use case?
Thank you for this interesting information!
Hi Azfar,
Thank you for reaching out.
We understand that you're looking for a single TypeScript definition file (.d.ts) that includes all Syncfusion EJ2 components. You can achieve this using the following NPM package:
NPM Package: @syncfusion/ej2-js-es5
Once downloaded, you can find the JavaScript files in the scripts folder within the package. For example:
node_modules └── ej2.d.ts |
The ej2.min.js file in the scripts folder is the compiled and minified file that includes all the required Syncfusion JavaScript functionalities. A comprehensive ej2.d.ts definition file covering all the types used in the bundled script.
We hope this information helps. If you need any further assistance reach out to us.
Regards,
Deepika
This is exactly what I needed.
Thanks!
This is great, but what if I need this for specific version? (not the latest one)?
Also, it seems like the ej2.d.ts file is not exactly es5 compatible.
There are hundreds of typescript compiler errors like:
> ej2.d.ts(423862,28): error TS2583: Build:Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later
However, I can get rid of them by switching "target" to "es6" in tsconfig.json.
Hi Kris Trzeciak,
Yes, you can use a specific version of the package. Please refer to the NPM link below to check available versions:
https://www.npmjs.com/package/@syncfusion/ej2-js-es5
To install a specific version, you can use:
npm i @syncfusion/[email protected]Regarding the TypeScript definition file compatibility, since the ej2.d.ts file includes modern type definitions, it is recommended to use ES6 in your tsconfig.json for smooth compilation.
Please let us know if you need any further assistance.
Regards,
Deepika