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
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"
letfoo=0console.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.
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"
Compilation results in the error:
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:
The text was updated successfully, but these errors were encountered: