ClassFieldDecoratorContext has addInitializer method which is not part of the spec. #57096
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
Milestone
π Search Terms
ClassFieldDecoratorContext, addInitializer, decorators, undefined
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.4.0-dev.20240119#code/GYVwdgxgLglg9mABAIwIYCcAUB9AXI1MATwBpFoAPfAYQBtUBnBgMRgFNaATAETYjnSooA6gihsKUAJSIA3gChE5BAzi02AOlpwA5pgBEDABZwQXFG0ThObYDDBtO+spQ2pOnAJJgYsVLRgALzZ0KQBueQBfeQh6JkRmODg5RUQAATR0FFRAxABeRABGKKA
π» Code
π Actual behavior
addInitializer is a function and ClassFieldDecoratorContext defines it as such
π Expected behavior
should be undefined undefined
+ a typescript compile error because it's wrong codeAdditional information about the issue
This is problematic because babel apparently follows whatever typescript does so it does work there, but swc follows the spec so code breaks there. For example, mobx works when compiling with tsc but breaks with swc: mobxjs/mobx#3817
Here's excerpts from the spec:
https://github.com/tc39/proposal-decorators
The text was updated successfully, but these errors were encountered: