ts-node REPL treats unparenthesized object literals as block scopes, doesnt align with node REPL behavior #1697
Closed
Description
Search Terms
repl object literal block scope
Expected Behavior
Input string: { key: "value" }
Node REPL behavior, also expected from ts-node:
Actual Behavior
Same input string, how ts-node REPL behaves:
Steps to reproduce the problem
In a terminal with ts-node installed:
- Run
ts-node
- Enter
{ key: "value" }
- Notice how
{}
's were treated as a block scope,key
as a (unused) label, leaving"value"
as the resulting string literal of the expression, instead of the expected object as seen innode
REPL above
Minimal reproduction
N/A (See above)
Specifications
- ts-node version:
v10.7.10
- node version:
v16.14.0
- TypeScript version:
v4.6.2
- tsconfig.json, if you're using one: N/A (REPL)
- Operating system and version: Android 11 aarch64 (Termux 0.118.0)