-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate identifier 'GeneratedTypes'.ts(2300) in blank project #6896
Comments
I resoved this problem putting:
|
yes but then using the local api of payload does not infer types |
It seems the issue comes from using the ts version in vs code: |
For the moment fix typescript version on
as mentioned here. |
@javierlinked thanks for the comment - you're right! fix incoming shortly |
Excluding the |
This is an issue with TS 5.5 and has been fixed by #6385. Will be available in the upcoming If this is still an issue in these versions, please let me know and I'll re-open |
We are running into the same issue with payload 2.22.1. Will the above fix be included in the next hotfix of V2? |
Also getting this issue with Payload 2.25.0. |
For Payload v2, please pin your TypeScript version to 5.4.5. We currently have no plans supporting TypeScript 5.5+ in Payload v2 |
Would you advise against using a workaround for this? |
Please provide us an solution for V2 .... kind regards. |
select typescript version 4.9.5 or any version <= 5.4.5 |
This issue has been automatically locked. |
Link to reproduction
No response
Describe the Bug
After generating the types from the blank project template, in the payload-types.ts i get the ts error:
Duplicate identifier 'GeneratedTypes'.ts(2300)
index.d.ts(23, 32): 'GeneratedTypes' was also declared here.
interface GeneratedTypes
declare module 'payload' {
export interface GeneratedTypes extends Config {}
}
And the local api does not infer types.
I got this error these days after opening some repos i didnt touch for a couple of months, it might be an issue with the latest vs code version maybe?!? i tried to reinstall vscode, do some other cleanings but i still get the ts error, even in the blank project.
My package.json is:
{
"name": "issue-types-payloadcms",
"description": "A blank template to get started with Payload",
"version": "1.0.0",
"main": "dist/server.js",
"license": "MIT",
"scripts": {
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
"build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
"build:server": "tsc",
"build": "yarn copyfiles && yarn build:payload && yarn build:server",
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
"copyfiles": "copyfiles -u 1 "src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}" dist/",
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema",
"payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload"
},
"dependencies": {
"@payloadcms/bundler-webpack": "^1.0.0",
"@payloadcms/db-mongodb": "^1.0.0",
"@payloadcms/plugin-cloud": "^3.0.0",
"@payloadcms/richtext-slate": "^1.0.0",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"express": "^4.19.2",
"payload": "^2.0.0"
},
"devDependencies": {
"@types/express": "^4.17.9",
"copyfiles": "^2.4.1",
"nodemon": "^2.0.6",
"ts-node": "^9.1.1",
"typescript": "^4.8.4"
}
}
To Reproduce
npx create-payload-app@latest
pnpm generate:types
Payload Version
^2.0.0
Adapters and Plugins
No response
The text was updated successfully, but these errors were encountered: