Skip to content

Commit

Permalink
fix: make Json object values possibly undefined
Browse files Browse the repository at this point in the history
See also denoland/std#2565. Omitting
`undefined` makes the `Json` type pretty annoying to use, e.g. when
passing values to `jsonb` columns/params.
  • Loading branch information
soedirgo committed Jun 12, 2023
1 parent 166fda0 commit 19308c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/templates/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const apply = ({
}, {} as Record<string, PostgresColumn[]>)

let output = `
export type Json = string | number | boolean | null | { [key: string]: Json } | Json[]
export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]
export interface Database {
${schemas
Expand Down
2 changes: 1 addition & 1 deletion test/server/typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('typegen', async () => {
| number
| boolean
| null
| { [key: string]: Json }
| { [key: string]: Json | undefined }
| Json[]
export interface Database {
Expand Down

0 comments on commit 19308c2

Please sign in to comment.