TypeScript definitions for ServiceNow client-side scoped application development.
See Using Class.create with TypeScript for API class creation.
dist/ServiceNow.code-snippets contains VS Code snippets to assist with AJAX calls.
Refer to the following repositories for other ServiceNow type definitions:
- sn_typings_client_global Client-Side Global.
- sn_typings_server_scoped Client-Side Scoped.
- sn_typings_server_global Server-Side Global.
Until the first version is published, you can reference these types using git submodules.
In this example, the submodule will be added at ./types/snc
:
mkdir types
git submodule add https://github.com/erwinel/sn_typings_client_scoped.git types/snc
cd types/snc
git checkout master
cd ../..
git commit -m "Added scoped client SNC typings"
You should add npm dependencies to your project using the following commands:
npm install -d typescript
npm install -d typedoc
npm install -d @popperjs/core
npm install -d @types/typescript
npm install -d @types/jquery
npm install -d @types/bootstrap
npm install -d @types/angular
In this example, the tsconfig.json file is located in the ./src
subdirectory, and we'll use the base path of the previous example for the typeRoots
setting:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": true,
"sourceMap": true,
"module": "none",
"target": "es6",
"strict": true,
"forceConsistentCasingInFileNames": true,
"allowJs": false,
"lib": [ "es6", "DOM" ],
"moduleResolution": "node",
"typeRoots": ["../node_modules/@types", "../types"],
"declaration": true,
"declarationDir": "../dist/types",
"outDir": "../dist/js"
}
}
If the submodules aren't cloned at the same time as the repository is cloned, you will need to initialize them using the following command:
git submodule update --init --recursive
cd types/snc
git checkout master
For the .devcontainer/devcontainer.json
file, you will need to include the aforementioned git command in the postCreateCommand
setting. Following is an example:
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/typescript:2": {}
},
"postCreateCommand": [
"npm install",
"git submodule update --init --recursive",
"cd types/snc; git checkout master"
]
}
In the following examples, the submodule exists at ./types/snc
.
cd types/snc
git pull --rebase
cd ../..
git commit -am "Updated types/snc submodule to latest revision"
In the following examples, the submodule exists at ./types/snc
.
cd types/snc
git add -A
git commit -am "[Your message here]"
git push
cd ../..
git commit -am "[Your message here]"
This is intended to be developed using VS Code. See /.vscode/extensions.json for a list of recommended extensions. Dependencies are mananged using npm.
After initially checking out this repository, you may need to run the following command to download the dependencies:
npm install