After installing the types using npm, you will also need to configure tsconfig.json to take the types into account.
To do so, you will need to add them to the compilerOptions.paths option.
A complete tsconfig.json file that matches the configuration of WoltLab Suite could look like the following.
After this initial set-up, you would place your TypeScript source files into the ts/ folder of your project.
To update the TypeScript types, the commit hash in package.json needs to be updated to an appropriate commit in the d.ts repository and npm install needs to be rerun.
WoltLab Suite uses additional tools to ensure the high quality and a consistent code style of the TypeScript modules.
The current configuration of these tools is as follows.
It is recommended to re-use this configuration as is.
After completing this initial set-up you can start writing your first TypeScript module.
The TypeScript compiler can be launched in Watch Mode by running npx tsc -w.
WoltLab Suite’s modules can be imported using the standard ECMAScript module import syntax by specifying the full module name.
The public API of the module can also be exported using the standard ECMAScript module export syntax.