Prisma queries return type any

I have a basic T3 app with Prisma that I just created today. Basic queries are giving a return type of any and I cannot figure out what I'm missing. Any ideas here?
No description
13 Replies
chawnsphone
chawnsphoneOP•10mo ago
I have ran prisma generate and restarted VS code. Looking at the type def for findUnique shows this return type. runtime.Types.Result is any.
No description
chawnsphone
chawnsphoneOP•10mo ago
Any help is greatly appreciated!
chawnsphone
chawnsphoneOP•10mo ago
Even with a brand new T3 app I'm getting this error
No description
JacobMGEvans
JacobMGEvans•10mo ago
What do the Prisma models look like? @julius who's the main maintainer for CT3A?
chawnsphone
chawnsphoneOP•10mo ago
Here's the default from T3
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")

// Do not use foreign keys (PlanetScale does not support them)
relationMode = "prisma"
}

model Post {
id Int @id @default(autoincrement())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@index([name])
}
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")

// Do not use foreign keys (PlanetScale does not support them)
relationMode = "prisma"
}

model Post {
id Int @id @default(autoincrement())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@index([name])
}
Alexander
Alexander•10mo ago
Hi, I get the same thing after creating a new project today. Curiously enough it seems like some queries work. I find that the Unique and Many queries both return 'any' values Well look at that... using npm instead of pnpm worked Man I despise these types of issues I hope you can get it working as well 🙂 Nvm, it's still problematic when you actually use the query I give up
Alexander
Alexander•10mo ago
GitHub
bug: "Error: Unsafe assignment of an any value" when trying to ru...
Provide environment information System: OS: Windows 10 10.0.19045 CPU: (6) x64 Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz Memory: 2.73 GB / 10.00 GB Binaries: Node: 21.1.0 - C:\Program Files\nodejs\n...
chawnsphone
chawnsphoneOP•10mo ago
Thanks for looking into this. Y’all rock!🪨
JacobMGEvans
JacobMGEvans•10mo ago
Aight I passed this off to the maintainers, honestly you will have to either manually write the inference Type logic or just hard cast it for now until this wiring gets fixed.
chawnsphone
chawnsphoneOP•10mo ago
Installing prisma latest (5.9.1) seems to fix the issue
hakkub
hakkub•10mo ago
I ran into this issue on a new project and after a couple of hours as a last resort I downloaded the latest version of VSCode and the issue went away. It appears to have been an IDE issue not a prisma issue. Hope this helps!
Alky
Alky•10mo ago
Me too. In my case the TS server was working, but the ESLint was throwing "as any" everywhere in my code. I ended up disabling a lot of rules(that i usually use) and i could work in peace. Today i got back to the project, enabled all the rules and the error wasn't there anymore. I have no idea what is causing the issue. I also tried create-t3-app today the same way as the issue, and the error was not there.
julius
julius•10mo ago
Might be depending on which pnpm version you’re using since some lower v8 versions installs the lowest matching range
Want results from more Discord servers?
Add your server