DT
Drizzle Team•7d ago
CS

TypeScript suddenly not working anymore

So I was refactoring my Project, to be able to share Drizzle/DB code between two NestJS APIs - so far working fine. But when pulling over the parts of the code that updated data in tables, I started noticing problems:
export const userBusinessDetails = mysqlTable("user_business_details", {
...abstractFields(),
user: varchar("user", { length: 36 })
.notNull()
.references(() => users.id)
.unique(), // one user can have only one business info record
about: text("about"),
termsAndConditions: text("terms_and_conditions"),
privacyPolicy: text("privacy_policy"),
termsOfRevocation: text("terms_of_revocation"),
moreInfo: text("more_info"),
taxNumber: varchar("tax_number", { length: 50 }),
businessName: varchar("business_name", { length: 100 }),
});
export const userBusinessDetails = mysqlTable("user_business_details", {
...abstractFields(),
user: varchar("user", { length: 36 })
.notNull()
.references(() => users.id)
.unique(), // one user can have only one business info record
about: text("about"),
termsAndConditions: text("terms_and_conditions"),
privacyPolicy: text("privacy_policy"),
termsOfRevocation: text("terms_of_revocation"),
moreInfo: text("more_info"),
taxNumber: varchar("tax_number", { length: 50 }),
businessName: varchar("business_name", { length: 100 }),
});
-> See related pic For some reason, on db.update(tableName).set(...values), Drizzle suddenly doesn't rrecognize all the fields anymore? I'm really not sure what to do at this point. Things I've tried: restart VS Code, restart TS language server, try different import/export paths, etc. If anybody knows why this issue might arise, please let me know. 👋
No description
4 Replies
CS
CSOP•7d ago
Here's what it shows when hovering over the update part in the new project
No description
CS
CSOP•7d ago
Here's what it shows when hovering over the older code
No description
CS
CSOP•6d ago
GitHub
[BUG]: Type inference error on db.insert() when applying default va...
What version of drizzle-orm are you using? 0.33.0 What version of drizzle-kit are you using? 0.24.0 Describe the Bug When trying to insert into a table via db.insert(schema.table).values( {} ), the...
CS
CSOP•6d ago
OK I am pretty sure that it's related -> Changing my tsconfig to strict with strict null checks for now Will require more refactoring but whatever

Did you find this page helpful?