-
-
Couldn't load subscription status.
- Fork 164
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
NUMERICorDECIMAL. - Generate TypeScript types for the table.
- Observe that the
Rowtype isnumber, but so are theInsertandUpdatetypes.
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.