-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
Describe the bug
db.insertInto('my_table').values(<some values>)
throws errors in Typescript since it expects the presence of fields and methods from XataRecord
.
To Reproduce
- Create a simple schema
- Use
xata pull
to codegen thexata.ts
file
Example code snippet from generated file:export type MyTable = InferredTypes["my_table"]; export type MyTableRecord = MyTable & XataRecord; export type DatabaseSchema = { my_table: MyTableRecord; };
- Build an
insertInto
statement with Kyselydb.insertInto('my_table').values({...myValues})
- Will throw TypeScript errors for
type ... is missing the following properties from type ... id, xata, getMetadata, toSerializable, and 4 more
- Those missing properties come from
XataRecord
- Those missing properties come from
Expected behavior
- Accept object without
XataRecord
properties to insert into a table
Software version
"dependencies": {
"@xata.io/client": "^0.30.1",
"@xata.io/kysely": "^0.2.1",
"kysely": "^0.27.4",
"zod": "^3.23.8",
"zod-validation-error": "^3.4.0"
},
Additional context
The docs only show an example for selecting a table entry. An insertInto example would be a great addition.
darrenbarklie, mateicanavra and Webstablish