From a2fd6736f45e8da35e4de3530c49bfc5182c528c Mon Sep 17 00:00:00 2001 From: ChrissiQ <1127719+ChrissiQ@users.noreply.github.com> Date: Tue, 22 Feb 2022 18:36:27 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20=20(TSDoc=20Definitions)=20Inher?= =?UTF-8?q?its=20doc=20for=20overloaded=20NS=20methods.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The overloaded methods `NS.kill()`, `NS.getScriptExpGain()`, `NS.getScriptIncome()`, and `NS.scp()` have broken documentation because the overloaded function is not documented correctly. I've added `@inheritDoc` tags to the declarations in order to associate the documentation to the overloaded method. As shown in these files with broken documentation: https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.kill_1.md https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.scp_1.md https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.getscriptexpgain_1.md https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.getscriptincome_1.md --- src/ScriptEditor/NetscriptDefinitions.d.ts | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 6e613ba80..404c598ac 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -4926,6 +4926,34 @@ export interface NS extends Singularity { * @returns True if the script is successfully killed, and false otherwise. */ kill(script: number): boolean; + + /** + * {@inheritDoc NS.(kill:1)} + * @example + * ```ts + * // NS1: + * //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments: + * kill("foo.script", "foodnstuff"); + * + * //The following will try to kill a script named foo.script on the current server that was ran with no arguments: + * kill("foo.script", getHostname()); + * + * //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”: + * kill("foo.script", getHostname(), 1, "foodnstuff"); + * ``` + * @example + * ```ts + * // NS2: + * //The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments: + * ns.kill("foo.script", "foodnstuff"); + * + * //The following will try to kill a script named foo.script on the current server that was ran with no arguments: + * ns.kill("foo.script", getHostname()); + * + * //The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”: + * ns.kill("foo.script", getHostname(), 1, "foodnstuff"); + * ``` + */ kill(script: string, host: string, ...args: string[]): boolean; /** @@ -4991,6 +5019,37 @@ export interface NS extends Singularity { * @returns True if the script/literature file is successfully copied over and false otherwise. If the files argument is an array then this function will return true if at least one of the files in the array is successfully copied. */ scp(files: string | string[], destination: string): Promise; + + /** + * {@inheritDoc NS.(scp:1)} + * @example + * ```ts + * // NS1: + * //Copies foo.lit from the helios server to the home computer: + * scp("foo.lit", "helios", "home"); + * + * //Tries to copy three files from rothman-uni to home computer: + * files = ["foo1.lit", "foo2.script", "foo3.script"]; + * scp(files, "rothman-uni", "home"); + * ``` + * @example + * ```ts + * // NS2: + * //Copies foo.lit from the helios server to the home computer: + * await ns.scp("foo.lit", "helios", "home"); + * + * //Tries to copy three files from rothman-uni to home computer: + * files = ["foo1.lit", "foo2.script", "foo3.script"]; + * await ns.scp(files, "rothman-uni", "home"); + * ``` + * @example + * ```ts + * //ns2, copies files from home to a target server + * const server = ns.args[0]; + * const files = ["hack.js","weaken.js","grow.js"]; + * await ns.scp(files, "home", server); + * ``` + */ scp(files: string | string[], source: string, destination: string): Promise; /** @@ -5795,6 +5854,10 @@ export interface NS extends Singularity { * @returns Amount of income the specified script generates while online. */ getScriptIncome(): [number, number]; + + /** + * {@inheritDoc NS.(getScriptIncome:1)} + */ getScriptIncome(script: string, host: string, ...args: string[]): number; /** @@ -5815,6 +5878,10 @@ export interface NS extends Singularity { * @returns Amount of hacking experience the specified script generates while online. */ getScriptExpGain(): number; + + /** + * {@inheritDoc NS.(getScriptExpGain:1)} + */ getScriptExpGain(script: string, host: string, ...args: string[]): number; /**