Typescript 5 decorators do not build
Open
@kdy1 is already working on this.
Since Nov 20, 2023.
bug
linear: next
SWC
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:46 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6020
Binaries:
Node: 19.7.0
npm: 9.5.0
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 13.3.1-canary.6
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)
SWC transpilation
Link to the code that reproduces this issue
https://github.com/austinlogo/nextjs-typescript-5
To Reproduce
Install and build as normal you should see an error in building types.
When you use the experimental flags in the tsconfig.json
Describe the Bug
This build Error
./src/pages/api/hello.ts
Error:
× Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key
╭─[/Users/logo/workspaces/scratch/ts5/test-types/src/pages/api/hello.ts:23:1]
23 │ }
24 │
25 │ class Test {
26 │ @loggedMethod
· ─
27 │ myMethod() {
28 │ return "hello";
29 │ }
╰────
Expected Behavior
I would expect it to build.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.