Typescript Imports

From RAGE Multiplayer Wiki
Revision as of 20:26, 12 July 2018 by Stuyk (talk | contribs)

Importing Typescript files and cross referencing them is quite easy.

If you're using Visual Studio Code ensure that you setup your Workspace in clientside_packages. If not do this now and re-initialize your project with:

tsc --init

After having your work space initialized and properly setup. Open up your tsconfig.json and add the following anywhere inside compilerOptions:

"baseUrl": "./",

If you place this at the bottom, remove the comma at the end.

You can now import your file by using:

import * as NameOfResource from "resource/path/of/file/from/clientside_packages/directory";

Make sure you don't add any extensions at the end.

For Additional Information / Example Usage