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
"use strict";var_a;function_classNameTDZError(name){thrownewError("Class \""+name+"\" cannot be referenced in computed property keys.");}_a=(_classNameTDZError("A"),A).a;varA=functionA(){};A.a=1;A[_a]=2;
And here is the output of the swc:
functiona(a,b,c){returnbina ? Object.defineProperty(a,b,{value: c,enumerable: !0,configurable: !0,writable: !0}) : a[b]=c,a;}varc=(function(a){thrownewError("Class \"A\" cannot be referenced in computed property keys.");}("A"),b).a,b=functionb(){"use strict";!function(a,b){if(!(ainstanceofb))thrownewTypeError("Cannot call a class as a function");}(this,b);};a(b,"a",1),a(b,c,2);
Both swc & babel output the correct result (where an error should be thrown).
The text was updated successfully, but these errors were encountered:
SukkaW
changed the title
esbuild didn't generate TDZ error when a class is referenced in its own computed property keys
esbuild won't create a TDZ error when a class is referenced in its own computed property keys
Feb 23, 2022
With given code:
Here is the output of the esbuild (with
--loader=js --target=es6
flag):And here is the output of the babel:
And here is the output of the swc:
Both swc & babel output the correct result (where an error should be thrown).
The text was updated successfully, but these errors were encountered: