Marcin Wanago
Explore posts from serversDTDrizzle Team
•Created by Marcin Wanago on 5/26/2024 in #help
Using the WITH clause with inserts
error TS2345: Argument of type 'Omit<PgInsertBase<PgTableWithColumns<{ name: "addresses"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "addresses"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; street: PgCo...' is not assignable to parameter of type 'TypedQueryBuilder<ColumnsSelection, unknown> | ((qb: QueryBuilder) => TypedQueryBuilder<ColumnsSelection, unknown>)'.
Type 'Omit<PgInsertBase<PgTableWithColumns<{ name: "addresses"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "addresses"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; street: PgCo...' is not assignable to type 'TypedQueryBuilder<ColumnsSelection, unknown>'.
Types of property '_' are incompatible.
Property 'selectedFields' is missing in type '{ readonly dialect: "pg"; readonly table: PgTableWithColumns<{ name: "addresses"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "addresses"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; ...' but required in type '{ selectedFields: ColumnsSelection; result: unknown; }'.
67 this.drizzleService.db
~~~~~~~~~~~~~~~~~~~~~~
68 .insert(databaseSchema.addresses)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 .values(user.address)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 .returning(),
~~~~~~~~~~~~~~~~~~~~~~
node_modules/drizzle-orm/query-builders/query-builder.d.ts:6:9
6 selectedFields: TSelection;
~~~~~~~~~~~~~~
'selectedFields' is declared here.
error TS2345: Argument of type 'Omit<PgInsertBase<PgTableWithColumns<{ name: "addresses"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "addresses"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; street: PgCo...' is not assignable to parameter of type 'TypedQueryBuilder<ColumnsSelection, unknown> | ((qb: QueryBuilder) => TypedQueryBuilder<ColumnsSelection, unknown>)'.
Type 'Omit<PgInsertBase<PgTableWithColumns<{ name: "addresses"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "addresses"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; street: PgCo...' is not assignable to type 'TypedQueryBuilder<ColumnsSelection, unknown>'.
Types of property '_' are incompatible.
Property 'selectedFields' is missing in type '{ readonly dialect: "pg"; readonly table: PgTableWithColumns<{ name: "addresses"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "addresses"; dataType: "number"; columnType: "PgSerial"; data: number; driverParam: number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; ...' but required in type '{ selectedFields: ColumnsSelection; result: unknown; }'.
67 this.drizzleService.db
~~~~~~~~~~~~~~~~~~~~~~
68 .insert(databaseSchema.addresses)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 .values(user.address)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 .returning(),
~~~~~~~~~~~~~~~~~~~~~~
node_modules/drizzle-orm/query-builders/query-builder.d.ts:6:9
6 selectedFields: TSelection;
~~~~~~~~~~~~~~
'selectedFields' is declared here.
3 replies