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

Upgrade esbuild for const type parameters? #48

Open
karlhorky opened this issue Jun 23, 2023 · 3 comments
Open

Upgrade esbuild for const type parameters? #48

karlhorky opened this issue Jun 23, 2023 · 3 comments

Comments

@karlhorky
Copy link

karlhorky commented Jun 23, 2023

Hey @lukeed πŸ‘‹ hope you're well!

It seems that [email protected] added support for TS 5.0 const type parameters

Currently, [email protected] depends on esbuild@^0.15.16, and runs into errors like Expected identifier but found "const":

✘ [ERROR] Expected identifier but found "const"

    /Users/k/p/project/index.ts:29:40:
      29 β”‚ export async function getProjectFixture<const Fixture extends { id: number }>(
         β•΅                                         ~~~~~

/Users/k/p/project/node_modules/tsm/node_modules/esbuild/lib/main.js:1575
  let error = new Error(`${text}${summary}`);
              ^

Error: Transform failed with 1 error:
/Users/k/p/project/index.ts:29:40: ERROR: Expected identifier but found "const"
    at failureErrorWithLog (/Users/k/p/project/node_modules/tsm/node_modules/esbuild/lib/main.js:1575:15)
    at /Users/k/p/project/node_modules/tsm/node_modules/esbuild/lib/main.js:814:29
    at responseCallbacks.<computed> (/Users/k/p/project/node_modules/tsm/node_modules/esbuild/lib/main.js:680:9)
    at handleIncomingPacket (/Users/k/p/project/node_modules/tsm/node_modules/esbuild/lib/main.js:735:9)
    at Socket.readFromStdout (/Users/k/p/project/node_modules/tsm/node_modules/esbuild/lib/main.js:656:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Proposed Solution

What do you think about upgrading to esbuild@^0.18.6?

Seems like forcing the upgrade to the transitive esbuild dependency via Yarn Resolutions works in our project and enables the const type parameters πŸ‘

@karlhorky
Copy link
Author

karlhorky commented Jun 23, 2023

Workaround

To upgrade tsm's transitive dependency esbuild@^0.15.16 to something newer, you can try using Yarn Resolutions like in the example below (or modify the example below for pnpm Overrides or npm Overrides):

package.json

{
  "resolutions": {
    "esbuild": "0.18.6"
  }
}

@lukeed
Copy link
Owner

lukeed commented Jun 27, 2023

Hi there, thanks :)

I wanted to cut a new major release today to include this (because of esbuild breaking changes), but I think that it should include support for Node 20.x (#46) which will probably also include some breaking changes. (Thanks Node team)

Please stick with the workaround for now :/ If there's no likely progress on Node-side with the process.argv issue within a few weeks, then I'll cut 3.0 and then another 4.0 once Node has act together.

@iliocatallo
Copy link

Hi!

Any news on this side?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants