-
-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When generating TypeScript types, the current code “correctly” converts numeric
types to number
, as Postgres and Postgrest return such columns as JSON numbers by default without a query cast to ::text
.
However, generated insert and update types are limited to number
, whereas the underlying APIs will accept a string
and preserve precision this way. As such, the generated update and insert types for these fields should allow for string
parameters.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Define a table with column type
NUMERIC
orDECIMAL
. - Generate TypeScript types for the table.
- Observe that the
Row
type isnumber
, but so are theInsert
andUpdate
types.
Expected behavior
number | string
is used instead for Insert
and Update
types.
Additional context
Currently we're having to cast strings as unknown as number
or @ts-expect-error
for all insert/update calls to get around this.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working