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

Optional Chaining not supported #11034

Closed
illeatmyhat opened this issue Jun 13, 2020 · 1 comment
Closed

Optional Chaining not supported #11034

illeatmyhat opened this issue Jun 13, 2020 · 1 comment

Comments

@illeatmyhat
Copy link

Bug report

What is the current behavior?
Using Optional Chaining in TypeScript results in an error expecting a loader.

If the current behavior is a bug, please provide the steps to reproduce.
Set tsconfig.json => "target": "es2020"

let foo = 0
console.log(foo?.toString())

Compilation results in the error:

Module parse failed: Unexpected token (5:16)
File was processed with these loaders:
 * ./node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| let foo = 0;
> console.log(foo?.toString());

What is the expected behavior?
Since ES2020 and TypeScript support Optional Chaining, the operator should be ignored by the loader and compilation should pass.

Other relevant information:
Stack Overflow indicates the issue lies with the webpack dependency Acorn, which implemented support for Optional Chaining in their 7.3.0 release from 3 days ago.

webpack version: 4.43
Node.js version: 14.3.0
ts-loader version: 7.0.5
Operating System: OS X Catalina 10.15.4 (19E287)
Additional tools:

@illeatmyhat
Copy link
Author

dupe of #10227

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

No branches or pull requests

1 participant