TypeScript Definitions for Service Now's APIs. This repository is structured into client and server side d.ts files, as well as release specific (Helsinki, Geneva, Fuji) as needed.
Recommend using typings npm project to install type definitions https://github.com/typings/typings
Using typings
For global or scoped apps prior to Helsinki that target ES3, add the rhino d.ts reference instead of using native lib.dts
Update your tsconfig to not use lib.d.ts when using es3 rhino
{
"compilerOptions": {
"target": "es3",
"noLib": true
}
}
In your project add a d.ts for your own service now types that you will be using, and extend the IGlideServerRecord with your type information using overload constants.
declare module sn {
export module Server {
export interface IGlideServerRecord {
new (type: 'sys_user'): sn.Types.IUser;
}
}
export module Types {
export interface IUser extends sn.Server.IGlideServerRecord {
sys_id: string;
firstname: string;
lastname: string;
name: string;
user_name: string;
email: string;
company: any;
title: string;
active: boolean;
source: string;
}
}
}
Then you can initialize your GlideRecord for sys_user and get property type information from IUser
var users = new GlideRecord('sys_user');