tsx icon indicating copy to clipboard operation
tsx copied to clipboard

Using `typeof` in REPL results in `undefined` output

Open coreyward opened this issue 2 years ago • 1 comments

Problem

I noticed that when using the REPL (yarn tsx), most expressions with typeof result in the output line being undefined. If it's in a ternary it seems to be okay, though.

Screenshot 2023-09-27 at 12 22 31 PM

Expected behavior

I expected this to match the behavior of the Node REPL, outputting the resultant value of the expression.

Minimal reproduction URL

https://github.com/esbuild-kit/tsx/assets/81224/eacf8fc5-8b7b-4085-b2b9-79a3b6c02d23

Version

v3.13.0

Node.js version

v18.16.1

Package manager

yarn

Operating system

macOS

Contributions

  • [ ] I plan to open a pull request for this issue
  • [ ] I plan to make a financial contribution to this project

coreyward avatar Sep 27 '23 17:09 coreyward

This is blocked by https://github.com/evanw/esbuild/issues/3502, but we may be able to hack around this by wrapping it in a IIFE: https://esbuild.github.io/try/#dAAwLjE5LjcAACgoKSA9PiB0eXBlb2YgMSkoKQ

privatenumber avatar Apr 18 '24 07:04 privatenumber