headintheclouddev / typings-suitescript-2.0

TypeScript typings for SuiteScript version 2.0
MIT License
142 stars 89 forks source link

Why not use `declare module` typings? #269

Open pauldraper opened 3 months ago

pauldraper commented 3 months ago

Path mappings work, but are rarely used since every downstream TypeScript project also has to set them.

More typical is module declarations.

declare module "N/log" {
}

These are then added by one of:

  1. Installing under @types as a npm alias (or having the project in DefinitelyTyped to begin with)
  2. Adding typeRoots.
  3. Referencing the types via tripe slash /// <reference types="..." />

Note that module declarations is how Node.js typings work (@types/node).