Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support TypeScript 4.9 #42978

Closed
1 task done
michaelhays opened this issue Nov 16, 2022 · 1 comment · Fixed by #42977
Closed
1 task done

Support TypeScript 4.9 #42978

michaelhays opened this issue Nov 16, 2022 · 1 comment · Fixed by #42977

Comments

@michaelhays
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022
Binaries:
  Node: 16.18.0
  npm: 8.19.2
  Yarn: N/A
  pnpm: 7.16.0
Relevant packages:
  next: 13.0.4-canary.2
  eslint-config-next: 13.0.3
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next dev or next start

Describe the Bug

I imagine you might have this on your radar, but I wanted to create this issue to track the progress. TypeScript 4.9 added a satisfies operator that greatly improves type specificity, but Next.js throws an error when trying to use satisfies:

error - ReferenceError: myVariable is not defined
    at Function.__webpack_require__.a (/path/to/project/.next/server/webpack-api-runtime.js:97:13)
    at eval (webpack-internal:///(api)/./src/pages/api/trpc/[trpc].ts:1:21)
    at Object.(api)/./src/pages/api/trpc/[trpc].ts (/path/to/project/.next/server/pages/api/trpc/[trpc].js:2233:1)
    at __webpack_require__ (/path/to/project/.next/server/webpack-api-runtime.js:33:42)
    at __webpack_exec__ (/path/to/project/.next/server/pages/api/trpc/[trpc].js:3485:39)
    at /path/to/project/.next/server/pages/api/trpc/[trpc].js:3486:28
    at Object.<anonymous> (/path/to/project/.next/server/pages/api/trpc/[trpc].js:3489:3)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at DevServer.runApi (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/next-server.js:467:34)
    at DevServer.handleApiRequest (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/next-server.js:812:21)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.fn (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/next-server.js:736:37)
    at async Router.execute (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/router.js:252:36)
    at async DevServer.run (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/base-server.js:384:29)
    at async DevServer.run (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/dev/next-dev-server.js:732:20)
    at async DevServer.handleRequest (/path/to/project/node_modules/.pnpm/next@13.0.4-canary.2_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/base-server.js:322:20)

Support for satisfies specifically was created as an issue that was moved to a Discussion: #40895

It looks like Next.js is currently on @swc/core 1.2.203, and TypeScript 4.8.2, and TypeScript 4.9 support wasn't added until swc 1.3.3. I'm guessing these versions need to be bumped in order to support TypeScript 4.9.

Expected Behavior

Should be able to use TypeScript 4.9.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

To Reproduce

Create a project with Typescript 4.9, and attempt to use the satisfies operator.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants