You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected type returned by the query for column some_column should be string[].
Rationale: some_column is array of Int8. Type Int8 is defined using ColumnType, where the first generic parameter (for SELECT) is defined as string. That means that the returned type for some_column should be string[].
Actual return type
However, the select query returns type Int8[] for some_column, because there is no support for array of ColumnType. In other words, ColumnType does not get "unwrapped" for array data type.
I have used kysely-codegen to generate the DB model. However, select statements do not return correct TS type corresponding to
int8[]
data type.Simplified example
TYPESCRIPT PLAYGROUND LINK
Consider the following schema (postgresql)
Given that this is the only table, the DB model generated by kysely-codegen would look like this (without any kysely-codegen customization):
Now, we have a function selecting the array:
Expected return type
Expected type returned by the query for column
some_column
should bestring[]
.Rationale:
some_column
is array ofInt8
. TypeInt8
is defined usingColumnType
, where the first generic parameter (for SELECT) is defined asstring
. That means that the returned type forsome_column
should bestring[]
.Actual return type
However, the select query returns type
Int8[]
forsome_column
, because there is no support for array ofColumnType
. In other words, ColumnType does not get "unwrapped" for array data type.TYPESCRIPT PLAYGROUND LINK
The text was updated successfully, but these errors were encountered: