ts-node REPL: error on multiline function arguments #1667
Closed
Description
Functions with arguments declared in one line work in ts-node
REPL:
> ts-node
> function myFn(a: string, b: string) {
... console.log(a, b)
... return a
... }
undefined
> myFn('test', '!')
test !
'test'
Trying to paste function with multline arguments declaration into ts-node
REPL:
function myFn2(
a: string,
b: string
) {
console.log(a, b)
return a
}
result:
> ts-node
> function myFn2(
<repl>.ts:9:10 - error TS2391: Function implementation is missing or not immediately following the declaration.
9 function myFn2(
~~~~~
<repl>.ts:9:10 - error TS7010: 'myFn2', which lacks return-type annotation, implicitly has an 'any' return type.
9 function myFn2(
~~~~~
<repl>.ts:10:1 - error TS1005: ')' expected.
Specifications
> ts-node -vv
ts-node v10.6.0
node v14.16.1
compiler v4.2.3
- Operating system and version:
> cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=19
DISTRIB_CODENAME=tara
DISTRIB_DESCRIPTION="Linux Mint 19 Tara"
> cat /etc/upstream-release/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"