Cant use query with pglite + drizzle local

This is my current instance
import { drizzle } from 'drizzle-orm/pglite'
import { cachedCategories } from './schema'

export const cache = drizzle({ connection: { dataDir: './cache/pglite' }, schema: cachedCategories })


import { json, pgTable, text } from 'drizzle-orm/pg-core'

export const cachedCategories = pgTable('categories', {
    url: text().primaryKey(),
    data: json().notNull()
})


Error:
Argument of type '[{ connection: { dataDir: string; }; schema: PgTableWithColumns<{ name: "categories"; schema: undefined; columns: { url: PgColumn<{ name: "url"; tableName: "categories"; dataType: "string"; columnType: "PgText"; data: string; ... 9 more ...; generated: undefined; }, {}, {}>; data: PgColumn<...>; }; dialect: "pg"; }>...' is not assignable to parameter of type '[] | [string | PGlite] | [string | PGlite, DrizzleConfig<Record<string, unknown>>] | [DrizzleConfig<Record<string, unknown>> & ({ ...; } | { ...; })]'.
  Type '[{ connection: { dataDir: string; }; schema: PgTableWithColumns<{ name: "categories"; schema: undefined; columns: { url: PgColumn<{ name: "url"; tableName: "categories"; dataType: "string"; columnType: "PgText"; data: string; ... 9 more ...; generated: undefined; }, {}, {}>; data: PgColumn<...>; }; dialect: "pg"; }>...' is not assignable to type '[string | PGlite] | [DrizzleConfig<Record<string, unknown>> & ({ connection?: string | (PGliteOptions<Extensions> & { ...; }) | undefined; } | { ...; })]'.
    Type '[{ connection: { dataDir: string; }; schema: PgTableWithColumns<{ name: "categories"; schema: undefined; columns: { url: PgColumn<{ name: "url"; tableName: "categories"; dataType: "string"; columnType: "PgText"; data: string; ... 9 more ...; generated: undefined; }, {}, {}>; data: PgColumn<...>; }; dialect: "pg"; }>...' is not assignable to type '[string | PGlite]'.
      Object literal may only specify known properties, and 'connection' does not exist in type 'PGlite'.
Was this page helpful?