Skip to content

Commit

Permalink
fix(types): ensure Values type dissolves
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Sep 6, 2022
1 parent e0a7d2b commit 36a8681
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/database/type.ts
Expand Up @@ -26,7 +26,9 @@ export type Value<T> = T extends Type<any, infer V> ? V : T
/** Convert a Postgres object to a JavaScript object */
export type Values<T extends object> = {
[P in keyof T]: Value<T[P]>
}
} extends infer Values
? Values
: never

/** Allow both the Postgres type and its JavaScript type */
export type Input<T> = T extends Type<any, infer Value> ? Value | T : T
Expand Down

0 comments on commit 36a8681

Please sign in to comment.