accessor keyword not supported
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
[Typescript 4.9 introduced a new keyword](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes) `accessor` to automatically make a property private and generate its accessors.
If I try to compile code that uses this keyword, I get the following error:
```
$ tsup src/index.ts --format esm --dts --clean
CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v6.6.3
CLI Target: es2022
CLI Cleaning output folder
ESM Build start
✘ [ERROR] Expected ";" but found "fieldName"
```
I rewrote my code to not use the keyword and it compiles perfectly.
Also, I compiled the code containing the keyword `accessor` using `tsc` and it is compiled properly.
So I suppose it's a compatibility issue with the last version of Typescript?
Contributor guide
Research direction
Start by reproducing the failure with the reported `tsup src/index.ts --format esm --dts --clean` command and compare it with the successful `tsc` compilation. Trace how tsup parses TypeScript containing the `accessor` keyword, then verify that the same example builds successfully after the compatibility issue is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100