ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

Wrong TS2345 error message in screenshot on website

Open muzimuzhi opened this issue 1 year ago • 0 comments

Search Terms

TS2345 screenshot

Expected Behavior

error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.

Actual Behavior

The screenshot on website () shows

error TS2345: Argument of type '"foo"' is not assignable to parameter of type 'number'.

in which the value "foo" is used as type.

Minimal reproduction

$ npx ts-node
> const x = 10
undefined
> const y = 'foo'
undefined
> function add(x: number, y: number) { return x + y }
undefined
> add(x, y)
<repl>.ts:7:8 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.

7 add(x, y)
         ~

muzimuzhi avatar Aug 17 '24 11:08 muzimuzhi