-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Describe the bug
If a class is followed by a TypeScript namespace, the decorator transform places variables generated for the class in the namespace.
Input code
class C {
[Symbol.iterator]() {}
}
namespace NS {
export function f() {}
}Config
{
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true
},
"transform": {
"decoratorVersion": "2022-03"
},
"target": "es2022"
},
"isModule": true
}Playground link (or link to the minimal reproduction)
SWC Info output
No response
Expected behavior
_computedKey is declared in the same scope as C.
var _computedKey;
_computedKey = Symbol.iterator;
class C {
[_computedKey]() {}
}
var NS;
(function(NS) {
function f() {}
NS.f = f;
})(NS || (NS = {}));Actual behavior
_computedKey is declared in the namespace.
_computedKey = Symbol.iterator;
class C {
[_computedKey]() {}
}
var NS;
(function(NS) {
var _computedKey;
function f() {}
NS.f = f;
})(NS || (NS = {}));Version
1.3.105
Additional context
No response