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:

If I remove the 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.0
Used Package Manager
npm
Validations
Describe the bug
If you create a simple TypeScript file with a class like so:
And try to write a test importing this file, rolloup throws an error
Unexpected tokenbar. Expected * for generator, private key, identifier or asyncReproduction
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:

If I remove the 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