The global.d.ts binds the NetscriptDefinitions.d.ts file to the entire project in most IDE's to let the LSP know where to look for some types.
The bare minimum to get it to work would be to just create the global.d.ts and add the following content in it:
import type * as NSD from 'NetscriptDefinitions';
declare global {
type NS = NSD.NS
}
and sometimes you also have to reference the globals file in a (ts/js)config.json #35
But to get all types to show up correctly that are declared in the NetscriptDefinitions.d.ts, you would have to individually also make aliases for them in the global.d.ts for the LSP to pick up on them.
This can instead be done by implementing a feature that generates all of these fields in one go and puts that in the globals file to save the user some work.
The
global.d.tsbinds theNetscriptDefinitions.d.tsfile to the entire project in most IDE's to let the LSP know where to look for some types.The bare minimum to get it to work would be to just create the
global.d.tsand add the following content in it:and sometimes you also have to reference the globals file in a (ts/js)config.json #35
But to get all types to show up correctly that are declared in the
NetscriptDefinitions.d.ts, you would have to individually also make aliases for them in theglobal.d.tsfor the LSP to pick up on them.This can instead be done by implementing a feature that generates all of these fields in one go and puts that in the globals file to save the user some work.