prisma: Typescript return type is suddenly `any` when having too many fields selected
Bug description
When selecting 14 fields everything is fine, but if I add one more the type returned will be any
How to reproduce
- Create a schema containing a model with more than 14 fields
- Create a function
async function test() {
return await prisma.test.findMany({
select {
a: true,
b: true,
c: true,
d: true,
e: true,
f: true,
g: true,
h: true,
i: true,
j: true,
k: true,
l: true,
m: true,
n: true,
//o: true,
}
})
}
- Remove comment before o
- See return type will be Promise<any>
Expected behavior
Return correct Promise containing all the types
Prisma information
model test {
a number
b number
c number
d number
e number
f number
g number
h number
i number
j number
k number
l number
m number
n number
o number
}
Environment & setup
- OS: macOS
- Database: CockroachDB
- Node.js version: v20.3.1
- TS Version: 5.1.6
Prisma Version
prisma : 4.16.2
@prisma/client : 4.16.2
Current platform : darwin-arm64
Query Engine (Node-API) : libquery-engine 4bc8b6e1b66cb932731fb1bdbbc550d1e010de81 (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine : migration-engine-cli 4bc8b6e1b66cb932731fb1bdbbc550d1e010de81 (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Format Wasm : @prisma/prisma-fmt-wasm 4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81
Default Engines Hash : 4bc8b6e1b66cb932731fb1bdbbc550d1e010de81
Studio : 0.484.0
Preview Features : extendedWhereUnique
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 22 (17 by maintainers)
Thanks for taking the time to reproduce. I think you used vs code. Maybe it’s about the used ide. I encountered the issue with phpstorm.
I will try to create a minimal example project with this issue.
@jorgerodrigues which ide did you use?
I was able to reproduce it. But only when using
selecton nested queries. I wasn’t able to reproduce the relation to the number of selected fields although this was clearly the case when I first encountered the issue.I uploaded the repo: https://github.com/Coder246/PrismaIssue20134
@Coder246 Interesting, for me
custom.d.tsis not picked up by VS Code and caused types to resolve to any, maybe could be related to your bug? I am not sure at this stage.Not yet, but I will take a look in the coming days.
I will update it here tomorrow with a reproduction that can be used. Just another piece of info:
includeorselect.Again, will try an example tomorrow and post here