next.js: Babel TypeScript transformer does not support satisfies operator

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: Ubuntu 20.04.0 LTS Wed Dec 07 2022 11:10:08 GMT+0300 (Москва, стандартное время) Binaries: Node: 16.14.2 npm: 7.17.0 Yarn: 1.22.19 pnpm: 7.13.6 Relevant packages: next: 13.0.7-canary.1 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://stackblitz.com/edit/vercel-next-js-pa3kjy?file=pages%2Findex.tsx

To Reproduce

npm run dev

Describe the Bug

./pages/index.tsx:10:20
Syntax error: Missing semicolon.

   8 | }
   9 |
> 10 | const user = {id: 1} satisfies User

Expected Behavior

No error

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 44
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@ jrolfs Unfortunately, I can’t get rid of Babel as easily as you can. Please tell me at the moment people have not found a way out of the situation? I can not use satisfies because of this problem(

did anyone manage to solve this? 🙏

Verсel seems to have no respect for users who still use the pages approach with babel configuration. 👎

any updates on this? afaik Next maintainers just need to bump babel and this would work…

I’d like to know how to speed up this process. It’s as if they are purposely ignoring this request and anything to do with babel users

Any updates on this issue? @domosedov were you able to find any workaround?

No

I upgraded and ensured all of our @babel/* dependencies were deduplicated and on the proper versions, and I still was unable to get this to work with Next’s Babel setup. I didn’t have time to dig into it more, but it seems like the issue might be with the next/babel preset. For anyone else having trouble, you might have luck replacing that preset entirely with @babel/preset-typescript, etc. (after following some of the guidance in https://github.com/babel/babel/issues/15157 to ensure you’re on the correct version of @babel/*). For the record, I was on Next.js 12.3.4.

I ultimately realized I really didn’t need the customizations our Babel configuration provided, and I ended up upgrading to Next.js 13.2.1 and removed our Babel configuration to switch to the SWC compiler. Everything is working great with that setup. If you’re looking to do the same, keep in mind that you’ll need to be on Next.js 13+ (satisfies support landed in the Next.js SWC toolchain in v13.0.5-canary.3). There might be a way to upgrade the SWC compiler independent of Next.js, but upgrading to 13 was pretty straightforward, so I didn’t look into it.

@domosedov Is it solved? Could you reopen if not?

Any news?