Weird type errors in Webstorm

export const priceDropAlerts = pgTable("price_drop_alerts", {
upc: bigint("upc", {mode: "number"}).notNull().primaryKey(),
createdAt: timestamp("created_at", {mode: "date"}).notNull(),
updatedAt: timestamp("updated_at", {mode: "date"}).notNull(),

productTitle: text("product_title").notNull(),
shopType: bigint("shop_type", {mode: "number"}).notNull(),
itemEntryId: bigint("item_entry_id", {mode: "number"}).notNull(),

priceOld: numeric("price_old", {precision: 7, scale: 2}).notNull(),
priceNew: numeric("price_new", {precision: 7, scale: 2}).notNull(),
percentLess: numeric("percent_less", {precision: 7, scale: 2}).notNull(),
priceDifference: numeric("price_difference", {precision: 7, scale: 2}).notNull(),

seenOn: timestamp("seen_on", {mode: "date"}),
})
export const priceDropAlerts = pgTable("price_drop_alerts", {
upc: bigint("upc", {mode: "number"}).notNull().primaryKey(),
createdAt: timestamp("created_at", {mode: "date"}).notNull(),
updatedAt: timestamp("updated_at", {mode: "date"}).notNull(),

productTitle: text("product_title").notNull(),
shopType: bigint("shop_type", {mode: "number"}).notNull(),
itemEntryId: bigint("item_entry_id", {mode: "number"}).notNull(),

priceOld: numeric("price_old", {precision: 7, scale: 2}).notNull(),
priceNew: numeric("price_new", {precision: 7, scale: 2}).notNull(),
percentLess: numeric("percent_less", {precision: 7, scale: 2}).notNull(),
priceDifference: numeric("price_difference", {precision: 7, scale: 2}).notNull(),

seenOn: timestamp("seen_on", {mode: "date"}),
})
"dependencies": {
"@auth/drizzle-adapter": "^0.3.14",
"@hookform/resolvers": "^3.3.4",
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/instrumentation": "^0.45.1",
"@opentelemetry/instrumentation-pg": "^0.37.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@t3-oss/env-nextjs": "^0.7.1",
"@tanstack/react-query": "^5.17.7",
"@trpc/client": "11.0.0-next-alpha.153",
"@trpc/next": "11.0.0-next-alpha.153",
"@trpc/react-query": "11.0.0-next-alpha.153",
"@trpc/server": "11.0.0-next-alpha.153",
"@vercel/otel": "^0.3.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"date-fns": "^2.30.0",
"drizzle-orm": "^0.29.3",
"js-md5": "^0.8.3",
"lucide-react": "^0.292.0",
"next": "^14.0.4",
"next-auth": "^4.24.5",
"next-themes": "^0.2.1",
"path": "^0.12.7",
"pg": "^8.11.3",
"react": "18.2.0",
"react-day-picker": "^8.10.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.49.2",
"sharp": "^0.32.6",
"sonner": "^1.3.1",
"superjson": "^2.2.1",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.56.1",
"@types/node": "^20.10.6",
"@types/pg": "^8.10.9",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"autoprefixer": "^10.4.16",
"dotenv-cli": "^7.3.0",
"drizzle-kit": "^0.20.10",
"eslint": "^8.56.0",
"eslint-config-next": "^14.0.4",
"nodemailer": "^6.9.8",
"postcss": "^8.4.33",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
}
"dependencies": {
"@auth/drizzle-adapter": "^0.3.14",
"@hookform/resolvers": "^3.3.4",
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/instrumentation": "^0.45.1",
"@opentelemetry/instrumentation-pg": "^0.37.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@t3-oss/env-nextjs": "^0.7.1",
"@tanstack/react-query": "^5.17.7",
"@trpc/client": "11.0.0-next-alpha.153",
"@trpc/next": "11.0.0-next-alpha.153",
"@trpc/react-query": "11.0.0-next-alpha.153",
"@trpc/server": "11.0.0-next-alpha.153",
"@vercel/otel": "^0.3.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"date-fns": "^2.30.0",
"drizzle-orm": "^0.29.3",
"js-md5": "^0.8.3",
"lucide-react": "^0.292.0",
"next": "^14.0.4",
"next-auth": "^4.24.5",
"next-themes": "^0.2.1",
"path": "^0.12.7",
"pg": "^8.11.3",
"react": "18.2.0",
"react-day-picker": "^8.10.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.49.2",
"sharp": "^0.32.6",
"sonner": "^1.3.1",
"superjson": "^2.2.1",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.56.1",
"@types/node": "^20.10.6",
"@types/pg": "^8.10.9",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"autoprefixer": "^10.4.16",
"dotenv-cli": "^7.3.0",
"drizzle-kit": "^0.20.10",
"eslint": "^8.56.0",
"eslint-config-next": "^14.0.4",
"nodemailer": "^6.9.8",
"postcss": "^8.4.33",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
}
No description
23 Replies
Angelelz
Angelelz11mo ago
Can I see your tsconfig?
Pistonmaster
PistonmasterOP11mo ago
{
"compilerOptions": {
"target": "es2017",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noUncheckedIndexedAccess": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
]
},
"plugins": [
{
"name": "next"
}
]
},
"include": [
".eslintrc.cjs",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.cjs",
"**/*.mjs",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
{
"compilerOptions": {
"target": "es2017",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noUncheckedIndexedAccess": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
]
},
"plugins": [
{
"name": "next"
}
]
},
"include": [
".eslintrc.cjs",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.cjs",
"**/*.mjs",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Angelelz
Angelelz11mo ago
In this case the type error is correct, there are a lot of columns in your table marked as not null without default
Pistonmaster
PistonmasterOP11mo ago
but update set doesn't require every column to be modified
Angelelz
Angelelz11mo ago
If you are inserting, you need to provide all non null columns that doesn't have a default
Pistonmaster
PistonmasterOP11mo ago
I sent the wrong screenshot here by accident.
Angelelz
Angelelz11mo ago
Yes, I just talking about this case Oh, ok Let me see the other one
Angelelz
Angelelz11mo ago
I can't reproduce. It works totally fine for me
No description
Pistonmaster
PistonmasterOP11mo ago
Could be WebStorms fault then.
Angelelz
Angelelz11mo ago
Your tsconfig seems fine too
Pistonmaster
PistonmasterOP11mo ago
I'll try with some other IDE tomorrow
Angelelz
Angelelz11mo ago
I don't even know what WebStorms is lol I thought it was a framework
Pistonmaster
PistonmasterOP11mo ago
It's Jetbrains proprietary javascript IDE I like it for the great tooling.
Angelelz
Angelelz11mo ago
Can you reproduce the error in vscode?
Pistonmaster
PistonmasterOP11mo ago
They did write in a blog post recently that they have their own language server implementation and wanna have a hybrid system with the official typescript language server in the future.
Angelelz
Angelelz11mo ago
Ooff
Pistonmaster
PistonmasterOP11mo ago
The JetBrains Blog
Try the Future TypeScript Engine With the WebStorm@next Program | T...
There is an experimental WebStorm@next build, which introduces improved type inference for enhanced performance and accuracy. You can install it via the Toolbox App.
Angelelz
Angelelz11mo ago
Why reinvent the wheel
Pistonmaster
PistonmasterOP11mo ago
Personally I heard the typescript language server likes to be slow and crash a lot. I think they also have it because it allows them to better integrate with their own completion systems. That's what I'll do tomorrow.
Angelelz
Angelelz11mo ago
Seems reasonable I think my lsp is tsserver It didn't show me an error
Pistonmaster
PistonmasterOP11mo ago
Seems like WebStorm supported typescript before they even had a official language API https://blog.jetbrains.com/webstorm/2024/01/everything-you-ve-always-wanted-to-know-about-typescript-s-integration-in-webstorm/
The JetBrains Blog
Everything You’ve Always Wanted to Know About TypeScript’s Integrat...
WebStorm's TypeScript integration evolved from a basic compiler to an advanced service, adapting to TypeScript's changes, especially the challenging shift to TypeScript 5.
Want results from more Discord servers?
Add your server