payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.48k stars 1.55k forks source link

Argument of type 'SQL<unknown>' is not assignable to parameter of type 'SQLWrapper'. #6538

Closed ainsleyclark closed 1 month ago

ainsleyclark commented 4 months ago

Link to reproduction

https://github.com/ainsleydev/go-payloadcms/tree/main/dev

Describe the Bug

When creating a migration, errors occur within the TS migration files:

➜  dev git:(main) ✗ pnpm run payload migrate:create

> test@1.0.0 payload dev
> cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload "migrate:create"

[09:23:55] INFO (payload): Starting Payload...
[09:23:55] INFO (payload): Migration created at /dev/src/migrations/20240528_082355.ts
[09:23:55] INFO (payload): Done.

It then creates the migration files, but the Typscript it generates doesn't look quite right (screenshot attached) So when pnpm run build is ran I get this:

11.86 src/migrations/20240528_081744.ts(107,35): error TS2345: Argument of type 'SQL<unknown>' is not assignable to parameter of type 'SQLWrapper'.
11.88  ELIFECYCLE  Command failed with exit code 2.
11.89  ELIFECYCLE  Command failed with exit code 2.
------

image

To Reproduce

Run pnpm run payload migrate:create from the repo provided.

Payload Version

2.18.3

Adapters and Plugins

Postgres DB

TomDo1234 commented 3 months ago

You guys can close this, because its not actually a payloadcms issue but a VS code configuration issue or IDE configuration issue.

You have to make sure your IDE like VScode is using the workspace TS version as its language server, not the global language server, I had my VSCode set to TS 5.5 and it causes this error. Make sure it uses the workspace ts server.

ainsleyclark commented 3 months ago

Thanks for the explanation @TomDo1234

r1tsuu commented 1 month ago

@TomDo1234 is right, it's recommended to use a TS version from the workspace, closing this as seems like resolved.

github-actions[bot] commented 1 month ago

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