You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running it works fine but trying to publish it to JSR cause me to get an error like so:
TS2612 [ERROR]: Property 'name' will overwrite the base property in'Foo'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.
public override name!: string;
Weirdly, that is not even a line in my code, guess it's the type definitions that JSR generates.
I did a workaround for this bug, and it turns out to be a known issue, previously reported in this repository: Swatinem/rollup-plugin-dts#156
In the deno publish code, there's a tsConfig flag called useDefineForClassFields, which is currently set to true. With this flag enabled, TypeScript follows JavaScript’s class field behavior, initializing fields with Object.defineProperty() instead of direct assignment. From my understanding, this causes this error when using the override in this context.
I did a quick POC by setting the flag to false in the deno_config repository, and it resolved the bug. Setting the flag to false reverts TypeScript to its older behavior, where class fields are initialized through simple assignment rather than Object.defineProperty().
I have a tree of errors that look something like that:
Running it works fine but trying to publish it to JSR cause me to get an error like so:
Weirdly, that is not even a line in my code, guess it's the type definitions that JSR generates.
My Deno version:
The text was updated successfully, but these errors were encountered: