diff --git a/env.d.ts b/env.d.ts index df7702d..8338331 100644 --- a/env.d.ts +++ b/env.d.ts @@ -231,12 +231,12 @@ type Fullsec = Subscripts & PlayerFullsec & { /** * **FULLSEC** */ - browse: ((args: { + browse: ((args: Partial<{ seller: string listed_before: number listed_after: number cost: number | string - } & CLIUpgrade) => { + } & CLIUpgrade>) => { i: string name: string rarity: Upgrade["rarity"] -- knotmirror 0.0.1 From 793f59b6ec82bfe4531d03fc0c954b904f954072 Mon Sep 17 00:00:00 2001 From: Aidan Nicoll <43973255+Longboyy@users.noreply.github.com> Date: Fri, 3 May 2024 04:17:55 +0100 Subject: [PATCH 2/7] Change market rarity values to make a little more sense --- env.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/env.d.ts b/env.d.ts index 8338331..9253796 100644 --- a/env.d.ts +++ b/env.d.ts @@ -44,12 +44,16 @@ interface PlayerLowsec {} interface PlayerNullsec {} +type RarityString = "noob" | "kiddie" | "h4x0r" | "h4rdc0r3" | "|_|b3|2" | "31337"; +type RarityNumber = 0 | 1 | 2 | 3 | 4 | 5; +type Rarity = RarityString | RarityNumber; + type UpgradeCore = { name: string type: "lock" | "script_space" | "chat" | "script" | "tool" | "bot_brain" | "glam" up_class?: -1 | 0 | 1 | 2 | 3 tier: 1 | 2 | 3 | 4 - rarity: 0 | 1 | 2 | 3 | 4 | 5 + rarity: RarityNumber i: number loaded: boolean sn: string @@ -60,7 +64,7 @@ type Upgrade = UpgradeCore & Record type CLIUpgrade = Omit & { [x: string]: null | boolean | number | string - rarity: "`0noob`" | "`1kiddie`" | "`2h4x0r`" | "`3h4rdc0r3`" | "`4|_|b3|2`" | "`531337`" + rarity: Rarity } type UsersTopItem = { @@ -840,7 +844,7 @@ type Highsec = Fullsec & PlayerHighsec & { }) => ( Omit & F & { [x: string]: null | boolean | number | string - rarity: "`0noob`" | "`1kiddie`" | "`2h4x0r`" | "`3h4rdc0r3`" | "`4|_|b3|2`" | "`531337`" + rarity: Rarity } )[] | ScriptFailure) } -- knotmirror 0.0.1 From a5e79396e52d3572ebe8d6ddb31dd5816b3b4668 Mon Sep 17 00:00:00 2001 From: Aidan <43973255+Longboyy@users.noreply.github.com> Date: Fri, 3 May 2024 23:30:54 +0100 Subject: [PATCH 3/7] Added `Scriptor` type --- env.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/env.d.ts b/env.d.ts index 9253796..19f3d05 100644 --- a/env.d.ts +++ b/env.d.ts @@ -14,6 +14,11 @@ type ScriptFailure = { type ScriptResponse = ScriptSuccess | ScriptFailure type ErrorScripts = Record ScriptFailure> +type Scriptor = { + name: string, + call: (args?: Args) => Ret +} + type Subscripts = Record< string, -- knotmirror 0.0.1 From f88edf20770477eb9595173974d85ec829fb2039 Mon Sep 17 00:00:00 2001 From: Aidan <43973255+Longboyy@users.noreply.github.com> Date: Sat, 4 May 2024 15:21:32 +0100 Subject: [PATCH 4/7] Changes for PR #171 - Simplified Scriptor type for now. - Fixed the rarity type that I broke - Renamed new types to fit convention --- env.d.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/env.d.ts b/env.d.ts index 19f3d05..3c96e1d 100644 --- a/env.d.ts +++ b/env.d.ts @@ -14,10 +14,14 @@ type ScriptFailure = { type ScriptResponse = ScriptSuccess | ScriptFailure type ErrorScripts = Record ScriptFailure> +type Scriptor = Pick ; + +/* type Scriptor = { name: string, call: (args?: Args) => Ret } +*/ type Subscripts = Record< @@ -49,16 +53,16 @@ interface PlayerLowsec {} interface PlayerNullsec {} -type RarityString = "noob" | "kiddie" | "h4x0r" | "h4rdc0r3" | "|_|b3|2" | "31337"; -type RarityNumber = 0 | 1 | 2 | 3 | 4 | 5; -type Rarity = RarityString | RarityNumber; +type UpgradeRarityString = "`0noob`" | "`1kiddie`" | "`2h4x0r`" | "`3h4rdc0r3`" | "`4|_|b3|2`" | "`531337`" +type UpgradeRarityNumber = 0 | 1 | 2 | 3 | 4 | 5; +type UpgradeRarity = UpgradeRarityString | UpgradeRarityNumber; type UpgradeCore = { name: string type: "lock" | "script_space" | "chat" | "script" | "tool" | "bot_brain" | "glam" up_class?: -1 | 0 | 1 | 2 | 3 tier: 1 | 2 | 3 | 4 - rarity: RarityNumber + rarity: UpgradeRarityNumber i: number loaded: boolean sn: string @@ -69,7 +73,7 @@ type Upgrade = UpgradeCore & Record type CLIUpgrade = Omit & { [x: string]: null | boolean | number | string - rarity: Rarity + rarity: UpgradeRarityString } type UsersTopItem = { @@ -245,7 +249,8 @@ type Fullsec = Subscripts & PlayerFullsec & { listed_before: number listed_after: number cost: number | string - } & CLIUpgrade>) => { + rarity: UpgradeRarityNumber + } & Omit>) => { i: string name: string rarity: Upgrade["rarity"] @@ -849,7 +854,7 @@ type Highsec = Fullsec & PlayerHighsec & { }) => ( Omit & F & { [x: string]: null | boolean | number | string - rarity: Rarity + rarity: UpgradeRarity } )[] | ScriptFailure) } -- knotmirror 0.0.1 From 70d7f798f503553f2f3c7dd68cdafd7e10998f8a Mon Sep 17 00:00:00 2001 From: Aidan <43973255+Longboyy@users.noreply.github.com> Date: Sat, 4 May 2024 15:23:54 +0100 Subject: [PATCH 5/7] Forgot to push this change - scriptor --- env.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env.d.ts b/env.d.ts index 3c96e1d..ac20068 100644 --- a/env.d.ts +++ b/env.d.ts @@ -14,7 +14,7 @@ type ScriptFailure = { type ScriptResponse = ScriptSuccess | ScriptFailure type ErrorScripts = Record ScriptFailure> -type Scriptor = Pick ; +type Scriptor = Pick; /* type Scriptor = { -- knotmirror 0.0.1 From e3ac812928d92a7536de4a14ae4a23c5aa10f650 Mon Sep 17 00:00:00 2001 From: Aidan <43973255+Longboyy@users.noreply.github.com> Date: Sat, 4 May 2024 18:49:18 +0100 Subject: [PATCH 6/7] Fixed Scriptor typing + rarity change --- env.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/env.d.ts b/env.d.ts index ac20068..7029964 100644 --- a/env.d.ts +++ b/env.d.ts @@ -14,7 +14,16 @@ type ScriptFailure = { type ScriptResponse = ScriptSuccess | ScriptFailure type ErrorScripts = Record ScriptFailure> -type Scriptor = Pick; +type AllOptional = { + [K in keyof T]-?: {} extends Pick ? true : false; +}[keyof T] extends true ? true : false; + +type Scriptor = { + name: string, + call: AllOptional extends true + ? (args?: Args) => Ret + : (args: Args) => Ret; +}; /* type Scriptor = { @@ -854,7 +863,7 @@ type Highsec = Fullsec & PlayerHighsec & { }) => ( Omit & F & { [x: string]: null | boolean | number | string - rarity: UpgradeRarity + rarity: UpgradeRarityString } )[] | ScriptFailure) } -- knotmirror 0.0.1 From 8e1e17102b4540b146f63851a0f9533134cd8166 Mon Sep 17 00:00:00 2001 From: Aidan <43973255+Longboyy@users.noreply.github.com> Date: Sat, 4 May 2024 19:21:26 +0100 Subject: [PATCH 7/7] Remove comment + semi-colons --- env.d.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/env.d.ts b/env.d.ts index 7029964..1a1722a 100644 --- a/env.d.ts +++ b/env.d.ts @@ -15,22 +15,15 @@ type ScriptResponse = ScriptSuccess | ScriptFailure type ErrorScripts = Record ScriptFailure> type AllOptional = { - [K in keyof T]-?: {} extends Pick ? true : false; -}[keyof T] extends true ? true : false; + [K in keyof T]-?: {} extends Pick ? true : false +}[keyof T] type Scriptor = { name: string, call: AllOptional extends true ? (args?: Args) => Ret - : (args: Args) => Ret; -}; - -/* -type Scriptor = { - name: string, - call: (args?: Args) => Ret + : (args: Args) => Ret } -*/ type Subscripts = Record<