How to write SuiteScript with typings
masterWhen writing scripts, include the appropriate JSDoc annotations (@NAPIVersion and @NScriptType) at the top of the file. Use the import type {EntryPoints} from 'N/types'; statement to access type definitions for your script's entry point functions. This allows your IDE to provide autocomplete and type-checking for the context argument and other SuiteScript modules.
/**
* @NAPIVersion 2.0
* @NScriptType ClientScript
*/
import type {EntryPoints} from 'N/types';
export let pageInit: EntryPoints.Client.pageInit = (context: EntryPoints.Client.pageInitContext) => {
// Your IDE will now autocomplete from the context argument.
// For instance, use this to access context.mode and context.currentRecord
}