diff --git a/src/repl.ts b/src/repl.ts index 41776e12e..6909f7c34 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -680,6 +680,8 @@ const RECOVERY_CODES: Set = new Set([ 1160, // "Unterminated template literal." 1161, // "Unterminated regular expression literal." 2355, // "A function whose declared type is neither 'void' nor 'any' must return a value." + 2391, // "Function implementation is missing or not immediately following the declaration." + 7010, // "Function, which lacks return-type annotation, implicitly has an 'any' return type." ]); /** diff --git a/src/test/repl/repl.spec.ts b/src/test/repl/repl.spec.ts index 3a106a389..0b61c58ce 100644 --- a/src/test/repl/repl.spec.ts +++ b/src/test/repl/repl.spec.ts @@ -424,6 +424,29 @@ test.suite( expect(stdout).toContain(":1:1'\n"); } ); + + // Serial because it's timing-sensitive + test.serial( + 'multiline function args declaration is supported', + async (t) => { + const script = `function myFn( + a: string, + b: string + ) { + return a + ' ' + b + } + myFn('test', '!') + `; + + const { stdout, stderr } = await t.context.executeInRepl(script, { + registerHooks: true, + startInternalOptions: { useGlobal: false }, + waitPattern: 'done!', + }); + expect(stderr).toBe(''); + expect(stdout).toContain(`'test !'`); + } + ); } );