Skip to content

ts-node REPL treats unparenthesized object literals as block scopes, doesnt align with node REPL behavior #1697

Description

@jhmaster2000

Search Terms

repl object literal block scope

Expected Behavior

Input string: { key: "value" }
Node REPL behavior, also expected from ts-node:
SmartSelect_20220324-030402_Termux

Actual Behavior

Same input string, how ts-node REPL behaves:
SmartSelect_20220324-030606_Termux

Steps to reproduce the problem

In a terminal with ts-node installed:

  1. Run ts-node
  2. Enter { key: "value" }
  3. 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 in node 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    you can do thisGood candidate for a pull request.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions