Closed szpolny closed 2 months ago
Ok, it turns out that this is problem with vscode. I opened project in webstorm and it returns correct type.
I am experiencing the same issue (VS Code).
Tried it on beta.40 and beta.53
Same issue, payload version: 2.0.0, VS Code. Typescript version 5.5.3 is not working.
Same issue, woke up today and suddenly had it.
Payload version 2.22.0 VS Code version 1.91.1
const { docs: orders } = await payload.find({
collection: "orders",
where: {
id: {
equals: orderId,
},
},
});
orders is now of type: (TypeWithID & Record<string, unknown>)[]
I believe this is due to a Duplicate identifier 'GeneratedTypes' in payload-types.ts
Issues: https://github.com/payloadcms/payload/issues/6958 https://github.com/payloadcms/payload/issues/6896
This appears to be a VS Code problem, as WebStorm doesn't have this problem.
Using TypeScript version 5.4.5 did not fix the issue for me.
I believe this is due to a Duplicate identifier 'GeneratedTypes' in payload-types.ts
Issues: #6958 #6896
This appears to be a VS Code problem, as WebStorm doesn't have this problem.
Using TypeScript version 5.4.5 did not fix the issue for me.
VC Code by default often uses an incorrect typescript version. You will have to set it to the workspace typescript version (5.4.5): https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript
I believe this is due to a Duplicate identifier 'GeneratedTypes' in payload-types.ts Issues: #6958 #6896 This appears to be a VS Code problem, as WebStorm doesn't have this problem. Using TypeScript version 5.4.5 did not fix the issue for me.
VC Code by default often uses an incorrect typescript version. You will have to set it to the workspace typescript version (5.4.5): https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript
Yup this fixed the issue for me, thank you! For whatever reason VS Code decided to switch to an incompatible version of TypeScript. Switching back to the workspace version fixed it just as you said.
Same issue and yet no solutions , payload@2.25.0 & typescript@5.5.4
Same issue and yet no solutions , payload@2.25.0 & typescript@5.5.4
Payload v2 does not and will never support TypeScript 5.5+. Please switch to TypeScript 5.4.5
Same issue and yet no solutions , payload@2.25.0 & typescript@5.5.4
Payload v2 does not and will never support TypeScript 5.5+. Please switch to TypeScript
5.4.5
Thank you
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
Payload Version
3.0.0-beta.47
Node Version
v22.3.0
Next.js Version
15.0.0-rc.0
Describe the Bug
In this code im quering 'news' collection from local api. Property docs, inside response object should be Type from generated:types but it is not.
Adapters and Plugins
db-postgres, storage-uploadthing, richtext-lexical