I can't create a simple table..

What am I doing wrong?
import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core";

export const users = pgTable('users', {
id: serial('id').primaryKey(),
});
import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core";

export const users = pgTable('users', {
id: serial('id').primaryKey(),
});
Type 'NotNull<PgSerialBuilderInitial<"id">>' is not assignable to type 'PgColumnBuilder<ColumnBuilderBaseConfig<ColumnDataType, string> & { data: any; }, object, object, ColumnBuilderExtraConfig>'.
The types of 'array(...).array(...)._' are incompatible between these types.
Type 'ColumnBuilderTypeConfig<{ name: "id"; dataType: "array"; columnType: "PgArray"; data: number[][]; driverParam: string | (string | number[])[]; enumValues: undefined; }, { baseBuilder: PgColumnBuilder<{ name: "id"; dataType: "array"; columnType: "PgArray"; data: number[]; driverParam: string | number[]; enumValues: u...' is not assignable to type 'ColumnBuilderTypeConfig<{ name: string; dataType: "array"; columnType: "PgArray"; data: any[][]; driverParam: string | (string | unknown[])[]; enumValues: string[] | undefined; }, { baseBuilder: PgColumnBuilder<{ name: string; dataType: "array"; columnType: "PgArray"; data: any[]; driverParam: string | unknown[]; en...'.
Types of property 'baseBuilder' are incompatible.
Type 'PgColumnBuilder<{ name: "id"; dataType: "array"; columnType: "PgArray"; data: number[]; driverParam: string | number[]; enumValues: undefined; }, object, object, ColumnBuilderExtraConfig>' is not assignable to type 'PgColumnBuilder<{ name: string; dataType: "array"; columnType: "PgArray"; data: any[]; driverParam: string | unknown[]; enumValues: string[] | undefined; }, object, object, ColumnBuilderExtraConfig>'.
Type 'string' is not assignable to type '"id"'.ts(2322)
Type 'NotNull<PgSerialBuilderInitial<"id">>' is not assignable to type 'PgColumnBuilder<ColumnBuilderBaseConfig<ColumnDataType, string> & { data: any; }, object, object, ColumnBuilderExtraConfig>'.
The types of 'array(...).array(...)._' are incompatible between these types.
Type 'ColumnBuilderTypeConfig<{ name: "id"; dataType: "array"; columnType: "PgArray"; data: number[][]; driverParam: string | (string | number[])[]; enumValues: undefined; }, { baseBuilder: PgColumnBuilder<{ name: "id"; dataType: "array"; columnType: "PgArray"; data: number[]; driverParam: string | number[]; enumValues: u...' is not assignable to type 'ColumnBuilderTypeConfig<{ name: string; dataType: "array"; columnType: "PgArray"; data: any[][]; driverParam: string | (string | unknown[])[]; enumValues: string[] | undefined; }, { baseBuilder: PgColumnBuilder<{ name: string; dataType: "array"; columnType: "PgArray"; data: any[]; driverParam: string | unknown[]; en...'.
Types of property 'baseBuilder' are incompatible.
Type 'PgColumnBuilder<{ name: "id"; dataType: "array"; columnType: "PgArray"; data: number[]; driverParam: string | number[]; enumValues: undefined; }, object, object, ColumnBuilderExtraConfig>' is not assignable to type 'PgColumnBuilder<{ name: string; dataType: "array"; columnType: "PgArray"; data: any[]; driverParam: string | unknown[]; enumValues: string[] | undefined; }, object, object, ColumnBuilderExtraConfig>'.
Type 'string' is not assignable to type '"id"'.ts(2322)
I am running on: drizzle-orm: ^0.28.3 next: 13.4.19 postgres: ^3.3.5 drizzle-kit: ^0.19.13 typescript: 5.1.6
No description
4 Replies
jrandeniya
jrandeniyaOP16mo ago
I've restarted Typescript, VSCode, deleted package-lock/node_modules and reinstalled all to no luck My TSConfig:
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
ArwanceR
ArwanceR16mo ago
I had the same issue after upgrading to 0.28.3, try downgrading to 0.28.2
jrandeniya
jrandeniyaOP16mo ago
Thank you - that worked!
Andrii Sherman
Andrii Sherman16mo ago
Sorry for that! We are working on fixing it asap the problem was only with esm types, which were not bundled in release all our pipelines check were for cjs projects and we will add esm checks as well
Want results from more Discord servers?
Add your server