Closed Kaidstor closed 2 weeks ago
drizzle-orm
0.35.3
drizzle-kit
0.26.2
I try to update value, but see error in types (using "drizzle-orm/node-postgres")
"typescript": "^5.6.3"
Object literal may only specify known properties, and 'solved' does not exist in type '{ msName?: SQL | string; projectId?: number | SQL; }'.
const raw = await db .update(schema.linkedToPid) .set({ solved: solved ? sql`CURRENT_TIMESTAMP` : null, }) .where( and( eq(schema.linkedToPid.id, id), eq(schema.linkedToPid.projectId, projectId), ), );
schema
export const linkedToPid3 = pgTable( 'ms-item-linked-to-pid', { id: bigint({ mode: 'number' }).generatedAlwaysAsIdentity(), msItemId: varchar({ length: 255 }).notNull(), msName: text().notNull(), solved: timestamp({ precision: 0 }), projectId: bigint({ mode: 'number' }).notNull(), }, (t) => ({ msItem: uniqueIndex().on(t.msItemId, t.msName, t.projectId), }), );
expect to update field that exists in my entity
tsconfig.json
{ "compilerOptions": { "module": "commonjs", "declaration": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "target": "ESNext", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", "incremental": true, "skipLibCheck": true, "strictNullChecks": false, "noImplicitAny": false, "strictBindCallApply": false, "strict": true, "forceConsistentCasingInFileNames": false, "noFallthroughCasesInSwitch": false, "esModuleInterop": true, "paths": { "@app/": ["./src/"], } }, "exclude": ["dist"] }
👋 can you try with strictNullChecks set to true?
strictNullChecks
yep it works ^) thanks bug fixed @rphlmr
What version of
drizzle-orm
are you using?0.35.3
What version of
drizzle-kit
are you using?0.26.2
Describe the Bug
I try to update value, but see error in types (using "drizzle-orm/node-postgres")
"typescript": "^5.6.3"
Object literal may only specify known properties, and 'solved' does not exist in type '{ msName?: SQL | string; projectId?: number | SQL; }'.
schema
Expected behavior
expect to update field that exists in my entity
Environment & setup
tsconfig.json
{ "compilerOptions": { "module": "commonjs", "declaration": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "target": "ESNext", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", "incremental": true, "skipLibCheck": true, "strictNullChecks": false, "noImplicitAny": false, "strictBindCallApply": false, "strict": true, "forceConsistentCasingInFileNames": false, "noFallthroughCasesInSwitch": false, "esModuleInterop": true, "paths": { "@app/": ["./src/"], } }, "exclude": ["dist"] }