Skip to content

Using Typescript 2.4 and above

Magnus Gether Sørensen edited this page Nov 24, 2017 · 1 revision

Typescript 2.4 added checks for weak types. This meant they changed the interface "Account" located in their standard library, such that it required displayname and id. Therefore it was no longer possible to use the type Account in XDT, without specifying a displayname and id.

Our proposed fix is to use the namespace functionality of XDT. When generating entities for either the Web or REST API, you can specify a string parameter along with it. All the generated types will be wrapped by a namespace with the specified name.

This means if you specify the namespace as "XDT" and you previously wrote

const entity: Account = {
    ...
};

You now write

const entity: XDT.Account = {
    ...
};

This fixes the issue introduced in 2.4 related to the modified interface in the standard library.

Clone this wiki locally