In REPL, can't access the previous line's return value via `_`
Iwaslazkis opened this issue · 0 comments
Iwaslazkis commented
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