Open scharf opened 3 years ago
This is the las version where the code compiles successfully:
npm i typescript@4.3.0-dev.20210407
This is the first version when the code breaks:
npm i typescript@4.3.0-dev.20210408
It is broken up to version npm i typescript@4.4.0-dev.20210802
Note that useDefineForClassFields
is by default true
when targeting ESNext
, but it needs to separately enabled in the Playground.
Bug Report
tsc
causes errors for--target ESNext
for some order of initialized variables and variables initialized in the constructor.Why does the code produce errors for
ESNext
and no error for any other target?π Search Terms
π Version & Regression Information
The command line fails on the code where the playground succeeds.
β― Playground Link
You have to set the
--target
toESNext
for this script Playground link with relevant codeπ» Code
Compiling this code with
./node_modules/.bin/tsc --target ESNext x.ts
I get the following error:
π Actual behavior
Running the code above in the playground there is no error, but
tsc
throws errors and fails to compile.π Expected behavior
Playground and the compiler should produce the same errors.