Skip to content

Commit

Permalink
Fix #674 TypeScript issues with dynamic inserts
Browse files Browse the repository at this point in the history
  • Loading branch information
alpharder committed Sep 18, 2023
1 parent 519575a commit ebc101d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,17 @@ type Rest<T> =
T extends TemplateStringsArray ? never : // force fallback to the tagged template function overload
T extends string ? readonly string[] :
T extends readonly any[][] ? readonly [] :
T extends readonly (object & infer R)[] ? readonly (Keys & keyof R)[] :
T extends readonly (object & infer R)[] ? (
readonly (Keys & keyof R)[] // sql(data, "prop", "prop2") syntax
|
[readonly (Keys & keyof R)[]] // sql(data, ["prop", "prop2"]) syntax
) :
T extends readonly any[] ? readonly [] :
T extends object ? readonly (Keys & keyof T)[] :
T extends object ? (
readonly (Keys & keyof T)[] // sql(data, "prop", "prop2") syntax
|
[readonly (Keys & keyof T)[]] // sql(data, ["prop", "prop2"]) syntax
) :
any

type Return<T, K extends readonly any[]> =
Expand Down

0 comments on commit ebc101d

Please sign in to comment.