Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In REPL, can't access the previous line's return value via _ #2087

Open
Iwaslazkis opened this issue Nov 16, 2023 · 0 comments
Open

In REPL, can't access the previous line's return value via _ #2087

Iwaslazkis opened this issue Nov 16, 2023 · 0 comments

Comments

@Iwaslazkis
Copy link

Search Terms

REPL, Return Value, _

Expected Behavior

$ ts-node
> const foo = 123
undefined
> foo
123
> _
123
> "strings, like anything else, should work"
'strings, like anything else, should work'
> const bar = _
undefined
> bar
'strings, like anything else, would work'
> 

Actual Behavior

$ ts-node
> const foo = 123
undefined
> foo
123
> _
<repl>.ts:6:1 - error TS2304: Cannot find name '_'.

6 _
  ~

> "strings don't work either"
"strings don't work either"
> const bar = _
<repl>.ts:7:13 - error TS2304: Cannot find name '_'.

7 const bar = _
              ~

> bar
<repl>.ts:7:1 - error TS2304: Cannot find name 'bar'.

7 bar
  ~~~

> 

Steps to reproduce the problem

Open a ts-node REPL, execute a line of code, and on the next line the return value should be accessible via _, just like on the normal node REPL, as described here.

Minimal reproduction

Given this is happening in any ts-node REPL environment as far as I can tell (at least on the versions mentioned below), I'm not sure what exactly what a "minimal reproduction" would look like here. Please specify what you want me to include if you still want one though, and I'd be happy to oblige.

Specifications

  • ts-node version: v10.9.1
  • node version: v19.7.0
  • TypeScript version: v5.1.6
  • tsconfig.json, if you're using one: N/A
  • package.json: N/A
  • Operating system and version: Linux 6.5.9-arch1-1, Arch Linux, GNOME
  • If Windows, are you using WSL or WSL2?: No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant