mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-18 10:53:43 +01:00
22 lines
657 B
TypeScript
22 lines
657 B
TypeScript
|
import { NSFull } from "../NetscriptFunctions";
|
||
|
import { AutocompleteData } 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) => 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;
|
||
|
}
|
||
|
}
|