-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Describe the bug
If you create a simple TypeScript file with a class like so:
class Foo {
accessor bar: string
constructor (s: string) {
this.bar = s
}
}And try to write a test importing this file, rolloup throws an error Unexpected token bar. Expected * for generator, private key, identifier or async
Reproduction
I'm testing with the following file: https://github.com/Formacao-Typescript/projeto-3/blob/vitest/src/domain/Class.ts
And this is the test: https://github.com/Formacao-Typescript/projeto-3/blob/vitest/src/domain/Class.test.ts
If I keep the accessor keyword:

System Info
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Memory: 729.30 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.2.0 - ~/.asdf/installs/nodejs/22.2.0/bin/node
Yarn: 1.22.22 - ~/.asdf/installs/nodejs/22.2.0/bin/yarn
npm: 10.7.0 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 9.4.0 - ~/.asdf/installs/nodejs/22.2.0/bin/pnpm
bun: 1.0.4 - ~/.asdf/shims/bun
Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
Browsers:
Safari: 17.5
npmPackages:
@vitest/coverage-v8: ^1.6.0 => 1.6.0
@vitest/ui: ^1.6.0 => 1.6.0
vitest: ^1.6.0 => 1.6.0Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
