TypeScript is an extension of JavaScript that adds type information to the language. It helps developers catch errors early through type checking and by providing code assist in supporting code editors, for example through code completion and inline documentation.
The types can be seen as a complementary addition to improve your development experience and help you write applications in modern JavaScript. You may always remove them from your app again in case of any issues. Browsers can’t execute TypeScript directly; it needs to be transpiled to JavaScript, which can then be executed as usual.
When writing TypeScript code, the type information can be scattered across the code. But you can also create separate type definition files for existing JavaScript libraries. For OpenUI5, we provide separate definition files that describe the OpenUI5 APIs and types. With the help of these definitions, you can write OpenUI5 apps in TypeScript and enjoy all the benefits that come with it.
OpenUI5 type definitions are provided via npm under the name @openui5/types
(published directly by the OpenUI5 development team) and @types/openui5
(maintained in the DefinitelyTyped infrastructure).
Providing the type definitions as a separate package allows you to retain an older version of the types while upgrading the OpenUI5 runtime, which is one of the options to mitigate incompatible changes of the types. For more information, see our compatibility statement.
We encourage you to use OpenUI5 with TypeScript for an improved development efficiency and experience. TypeScript itself keeps evolving, and we try to further improve the OpenUI5 type definitions, so there could be potential incompatible changes between versions of the type definitions. However, such incompatibilities would only affect the compilation of your code but will not cause runtime issues in your application. Plus, there are various ways to easily deal with them: You can, for example, simply keep using the previous version of the type definitions together with an updated OpenUI5 runtime. For more information, see Breaking changes below.
Known incompatibilities will be communicated in the OpenUI5-TypeScript release notes, and in the What’s New in OpenUI5.
OpenUI5 with TypeScript is in its final stage of stability, so please go ahead and use it! However, breaking changes can still occur. Possible reasons are:
For more information, see here.
To mitigate breaking changes, you have several options; some of them are listed here: How to mitigate breaking changes?
npm Packages (check the individual packages for licensing information):