FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[BUG]: TypeError: Object literal may only specify known properties

Fresh3 days ago
Mar 14, 20260 views
Confidence Score74%
74%

Problem

What version of `drizzle-orm` are you using? 0.32.0 What version of `drizzle-kit` are you using? 0.23.0 Describe the Bug I bumped the versions of drizzle-orm 0.31.4 -> 0.32.0 and drizzle-kit 0.22.8 -> 0.23.0. After that my project stopped from building because some of the columns are not being recognized by the type system. I provided the error log, table definition and code that uses it below. TS compiler error log: [code block] Table definition in schema.ts: [code block] Usage of table to perform queries: [code block] Expected behavior All specified columns being recognized by the type system on writing queries Environment & setup Node.js v20.12.2 drizzle-kit v0.32.0 drizzle-orm v0.23.0

Error Output

error log, table definition and code that uses it below.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Fix TypeError in drizzle-orm and drizzle-kit Integration

Medium Risk

The TypeError occurs because the type definitions in drizzle-orm 0.32.0 and drizzle-kit 0.23.0 may have introduced changes that are incompatible with the existing schema definitions in your project. Specifically, the columns defined in your schema may not match the expected types or structure defined by the new versions of these libraries.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Check and Update Column Definitions

    Review the column definitions in your schema.ts file to ensure they match the expected types in drizzle-orm 0.32.0. Update any mismatched types or structures.

    typescript
    type User = { id: number; name: string; email: string; }; // Ensure all columns are correctly typed
  2. 2

    Review and Update Query Usage

    Examine the code where you are using the table to perform queries. Ensure that the queries reference the updated column types and structures as defined in the schema.

    typescript
    const userQuery = db.users.find({ id: 1 }); // Ensure this matches the updated User type
  3. 3

    Check for Breaking Changes in Documentation

    Consult the changelogs or migration guides for drizzle-orm and drizzle-kit to identify any breaking changes that may affect your current implementation.

    bash
    npm info drizzle-orm changelog
  4. 4

    Reinstall Node Modules

    After making the necessary updates, delete the node_modules folder and reinstall the dependencies to ensure that all packages are correctly updated and compatible.

    bash
    rm -rf node_modules && npm install
  5. 5

    Run TypeScript Compiler

    After making the changes, run the TypeScript compiler to check for any remaining type errors. This will help confirm that all issues related to the TypeError have been resolved.

    bash
    tsc

Validation

Confirm that the TypeScript compiler runs without errors and that the application builds successfully. Additionally, run any existing tests to ensure functionality remains intact.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptbugdocsdocs/undocumentedpriority