Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass useDefineForClassFields tsconfig compiler option to SWC #2049

Closed
wants to merge 1 commit into from

Conversation

valentin-nemcev
Copy link

@valentin-nemcev valentin-nemcev commented Sep 1, 2023

Defaults for this option may be different between tsc and SWC, and explicit override in ts-node is ignored.

This prevents drop-in replacement of ts-node --swc in place of ts-node for cases when the value of useDefineForClassFields is important

Here is an example of the problem this PR is attempting to fix:

tsconfig.json:

{
  "compilerOptions": {
    "target": "es2021",
    "useDefineForClassFields": false
  }
}
$ ts-node -pe 'new class { f?:any }'
{}

$ ts-node --swc -pe 'new class { f?:any }'
{ f: undefined } # but should be {}

Defaults for this option may be different between tsc and SWC, and explicit override in ts-node is ignored.

This prevents drop-in replacement of `ts-node --swc` in place of `ts-node` for cases when the value of `useDefineForClassFields` is important
@cspotcode cspotcode mentioned this pull request Sep 14, 2023
@cspotcode
Copy link
Collaborator

Fixed via #2062

@cspotcode cspotcode closed this Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants