From 34f0749807674b36e0884f044ddcddfc690a5245 Mon Sep 17 00:00:00 2001 From: Samual Norman Date: Tue, 4 Jun 2024 23:10:59 +0100 Subject: [PATCH] simplify `Scriptor` type its call method now always returns `unknown`, this is because callers should validate its return if they plan to use it can now specify multiple args if needed defaults to accepting any number of any arguments --- env.d.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/env.d.ts b/env.d.ts index 3667826..7892a96 100644 --- a/env.d.ts +++ b/env.d.ts @@ -3,13 +3,7 @@ type ScriptSuccess = { ok: true } & T type ScriptFailure = { ok: false, msg?: string } type ScriptResponse = ScriptSuccess | ScriptFailure type ErrorScripts = Record ScriptFailure> - -type AllOptional = { [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: TArgs) => unknown } type Subscripts = Record any>> & { accts: ErrorScripts -- knotmirror 0.0.1