diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 1ff3a2acada46..01ac1000513ba 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2448,7 +2448,7 @@ export function scanTokenAtPosition(sourceFile: SourceFile, pos: number): Syntax function getErrorSpanForArrowFunction(sourceFile: SourceFile, node: ArrowFunction): TextSpan { const pos = skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === SyntaxKind.Block) { + if (node.body) { const { line: startLine } = getLineAndCharacterOfPosition(sourceFile, node.body.pos); const { line: endLine } = getLineAndCharacterOfPosition(sourceFile, node.body.end); if (startLine < endLine) { diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt index 0cc9ee2b6a98f..d8483073c2b4c 100644 --- a/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt +++ b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt @@ -108,8 +108,7 @@ arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => num // body is not a block f(_ => 1 + ~~~~~~~~ - 2); - ~~~~~ !!! error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. !!! error TS2345: Target signature provides too few arguments. Expected 1 or more, but got 0. + 2); \ No newline at end of file diff --git a/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt index 523bfb49a270b..7f4ed09b2570e 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt @@ -44,20 +44,16 @@ file.tsx(39,15): error TS2322: Type '(user: IUser) => Element' is not assignable { user => ( ~~~~~~~~~ -

{ user.Name }

- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ) } - ~~~~~~~~~~~~~ !!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'. !!! related TS6212 file.tsx:36:15: Did you mean to call this expression? - { user => ( - ~~~~~~~~~

{ user.Name }

- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) } - ~~~~~~~~~~~~~ + { user => ( + ~~~~~~~~~ !!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'boolean | any[] | ReactChild'. !!! related TS6212 file.tsx:39:15: Did you mean to call this expression? +

{ user.Name }

+ ) } ); } \ No newline at end of file