Open nickserv opened 2 years ago
I'm guessing this is the culprit.
Probably this logic made more sense in the past, but things have changed since then.
While we're at it we can look at this, too.
I don't remember off-hand but I think there are situations where you need to specify module and moduleResolution, when one should be sufficient to imply the other.
Search Terms
Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
Expected Behavior
Using
"module": "node16"
or"module": "nodenext"
setstarget
toes2017
or newer and compiles without an error. This is what happens if you usetsc
instead ofts-node --esm
.Actual Behavior
target
is set to the default ofes5
, causing the following error:Steps to reproduce the problem
Use
"module": "node16"
or"module": "nodenext"
withouttarget
and with"type": "module"
inpackage.json
.Minimal reproduction
ts-node --esm index.ts
Specifications