View on GitHub

UI5 & TypeScript

The central entry point for everything TypeScript-related in SAPUI5/OpenUI5

FAQ - Frequently Asked Questions for the UI5 Type Definitions

While the main page answers the high-level questions, this page focuses on specific questions and tricky areas one might encounter when using UI5 with TypeScript, especially for those questions where the answers may still be developing or are subject to change.

How to reference the UI5 types in tsconfig.json? As types or typeRoots? (also: “error TS2688 Cannot find type definition file for ‘node_modules’”)

Short answer:

The history of this topic unfolds in this issue report. An in-depth analysis can be found here. The proposed solution changed over time, triggered by changes in TypeScript itself.

Related error messages (helping people to find this explanation) are:

error TS2688: Cannot find type definition file for 'node_modules'.
  The file is in the program because:
    Entry point for implicit type library 'node_modules'
error TS2688: Cannot find type definition file for '@sapui5/types'.
  The file is in the program because:
    Entry point of type library '@sapui5/types' specified in compilerOptions

Also see this and this article about these “known issues”.

How to use Controller Extensions in TypeScript?

There are two distinct ways of working with Controller Extensions in UI5:

  1. Writing an extension to modify the behavior of an existing Controller without touching its code. This is done to extend/change e.g. SAP-delivered standard apps. This topic was mainly handled here. In particular see the explanation of the solution here and the references to documentation and samples here.

  2. Using a pre-defined controller extension when writing a controller in order to benefit from the functionality provided by this extension. One could also characterize this as applying mix-ins to add functionality. There are a couple of such controller extensions provided by sap.fe. This topic is being handled here and not 100% complete despite a change that provided support for this use-case (check out the details there).

Legal Information & Privacy Statement

This site is hosted by GitHub Pages. Please see the GitHub Privacy Statement for any information how GitHub processes your personal data.

Please note the SAP terms of use.

Legal Statement / Impressum

Trademark Notice