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
class Class {
static staticField;
field;
}
const instance = new Class();
console.log(instance)
console.log(Class)
Expected behaviour
When running node -r @swc-node/register ./index.ts, index.ts is transpiled with the SWC option useDefineForClassFields: false and logs the following output:
If the value of useDefineForClassFields is set in tsconfig.json, use that value.
Otherwise, if the target is ES2022 or later, use true.
Otherwise, use false.
Actual behaviour
Regardless of the setting for target or useDefineForClassFields, index.ts is transpiled without passing the useDefineForClassFields option to SWC, defaults to useDefineForClassFields: true and logs the following output:
The value of
useDefineForClassFields
intsconfig.json
is ignored when creating the SWC config.Reproduction
tsconfig.json
index.ts
Expected behaviour
When running
node -r @swc-node/register ./index.ts
,index.ts
is transpiled with the SWC optionuseDefineForClassFields: false
and logs the following output:useDefineForClassFields
should be set in the SWC config based on the behaviour specified at https://www.typescriptlang.org/tsconfig#useDefineForClassFields, i.e.:If the value of
useDefineForClassFields
is set intsconfig.json
, use that value.Otherwise, if the target is ES2022 or later, use
true
.Otherwise, use
false
.Actual behaviour
Regardless of the setting for
target
oruseDefineForClassFields
,index.ts
is transpiled without passing theuseDefineForClassFields
option to SWC, defaults touseDefineForClassFields: true
and logs the following output:The text was updated successfully, but these errors were encountered: