mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
22 lines
700 B
TypeScript
22 lines
700 B
TypeScript
import type { NSFull } from "../NetscriptFunctions";
|
|
import type { AutocompleteData, ScriptArg } from "@nsdefs";
|
|
|
|
// The object portion of this type is not runtime information, it's only to ensure type validation
|
|
// And make it harder to overwrite a url with a random non-url string.
|
|
export type ScriptURL = string & { __type: "ScriptURL" };
|
|
|
|
export interface ScriptModule {
|
|
main?: (ns: NSFull, ...args: ScriptArg[]) => unknown;
|
|
autocomplete?: (data: AutocompleteData, flags: string[]) => unknown;
|
|
}
|
|
|
|
export class LoadedModule {
|
|
url: ScriptURL;
|
|
module: Promise<ScriptModule>;
|
|
|
|
constructor(url: ScriptURL, module: Promise<ScriptModule>) {
|
|
this.url = url;
|
|
this.module = module;
|
|
}
|
|
}
|