Skip to content

erwinel/sn_typings_client_scoped

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sn_typings_client_scoped

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:

Usage

Until the first version is published, you can reference these types using git submodules.

Adding Typings to Another Repository

Add submodule

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"

Base Type Dependencies

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

TypeScript Configuration

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"
  }
}

Initialize Submodule After Repository Cloning

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

DevContainer Configuration

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"
  ]
}

Update Submodule from Origin

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"

Push Submodule Updates to Origin

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]"

Dev Setup

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

About

ServiceNow typings for scoped client application development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published