Skip to content
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

Type collision with generated types #6958

Closed
bajzarpa opened this issue Jun 27, 2024 · 7 comments
Closed

Type collision with generated types #6958

bajzarpa opened this issue Jun 27, 2024 · 7 comments
Assignees
Labels

Comments

@bajzarpa
Copy link

Link to reproduction

No response

Describe the Bug

The payload-types.ts exports an interface like this:

export interface GeneratedTypes extends Config {}

but the node_modules/payload/dist/index.d.ts also declares a GeneratedTypes which collides with the GeneratedTypes above.

Sometimes the ts uses the payload-types.ts other times it uses node_modules/payload/dist/index.d.ts

And this what cause the TypeWithID & Record<string, unknown> errors when using local api.

To Reproduce

Its random, sometimes one GeneratedTypes has been referenced instead of the other

Payload Version

2.22.2

Adapters and Plugins

No response

@bajzarpa bajzarpa added status: needs-triage Possible bug which hasn't been reproduced yet v2 labels Jun 27, 2024
@neslob
Copy link

neslob commented Jun 27, 2024

--- 2024-06-28 UPDATE ---

This happens on 3.0.0-beta.53 for me.


Getting the same error.

No idea, where this came from. Sadly I did not throughly committed while testing.

For me, even pnpm run dev broke.
But, I without turbo, it works.

    "start": "next dev",
    "dev": "next dev --turbo",

Breaking production builds could be solved by removing/commenting the generate code


// declare module 'payload' {
//   export interface GeneratedTypes extends Config {}
// }

@AlessioGr
Copy link
Member

AlessioGr commented Jun 27, 2024

Are you on TypeScript 5.5 or 5.4? If you are on TypeScript 5.5, can you check if this issue still appears on 5.4? (We do not support TypeScript 5.5 on 2.0)

@AlessioGr AlessioGr self-assigned this Jun 27, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jun 27, 2024
@neslob
Copy link

neslob commented Jun 28, 2024

Oh! sorry, I have missed details (added above).

For me, it is happening on 3.0.0-beta.53.
Yes, it happens on TypeScript 5.5. But downgrading, did not solve it.

I am happy to open a separate issue.

@bajzarpa
Copy link
Author

bajzarpa commented Jun 28, 2024

Are you on TypeScript 5.5 or 5.4? If you are on TypeScript 5.5, can you check if this issue still appears on 5.4? (We do not support TypeScript 5.5 on 2.0)

Downgrading TS to 5.4 fixed this issue indeed. Thank you @AlessioGr

@carstenblt
Copy link

Oh! sorry, I have missed details (added above).

For me, it is happening on 3.0.0-beta.53. Yes, it happens on TypeScript 5.5. But downgrading, did not solve it.

I am happy to open a separate issue.

Check if ts is really downgraded. If you use ^5.4.5, pnpm will still install/keep 5.5.

Had the same problem, keeping 5.4.5 worked.

@paulpopus
Copy link
Contributor

Closing, we will support ts 5.5 on 3.0 but 2.0 will be compatible with 5.4.5 only.

Copy link
Contributor

github-actions bot commented Sep 7, 2024

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants