Still an interesting case though.
Based on the description on the Typescript site (see what’s new 4.9), the accessor part can easily be rewritten to use getter/setter methods.
In (almost) the most simple form, I’ve tried to change this in the base application:
export class MyApp {
//public accessor message = 'Hello World!';
#__message = 'Hello World!';
get message() {
return this.#__message;
}
set message(value: string) {
this.#__message = value;
}
}
The accessor keyword indeed failed like described. But so did the example using the #
. The name of the unreachable private property does not matter. The code fails on accessing this.#__message
problably from another class.
I’ve tried debugging in the compiled code, but without really knowing where to look for it is kinda obscure.
The __decorateElement
I think is an esbuild symbol, I was not able to find it anywhere within (uncompiled) code, only in the esbuild binary.
Step by step I reached the Aurelia part, in Main.ts
. I stepped into the Aurelia.app(MyApp), and encountered this part:
I think this is provided to Aurelia from the compiled code itself. Notice how
message
is written here. And remember that my unaccessable private property was defined as
#__message
I’ve tried to access message
via the config object using console, but that failed:
Conclusion #1
So, unless I’m mistaken, I think the actual issue already exists before reaching the Aurelia part. It might be esbuild…?
Right, so checking the package-lock.json
for any discrepancies. And there actually are!
Latest version of esbuild is 0.24.2
, whereas @aurelia/vite-plugin
and vite-node
both use 0.21.5
.
I’ve tried to use npm overrides, forcing esbuild
to the latest version for both these two modules, but this did not solve the issue.
No clue what other options to try… HTH
THE END