Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions tests/baselines/reference/arrowFunctionErrorSpan.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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);

12 changes: 4 additions & 8 deletions tests/baselines/reference/checkJsxChildrenProperty4.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,16 @@ file.tsx(39,15): error TS2322: Type '(user: IUser) => Element' is not assignable

{ user => (
~~~~~~~~~
<h1>{ user.Name }</h1>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
) }
~~~~~~~~~~~~~
!!! 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 => (
~~~~~~~~~
<h1>{ user.Name }</h1>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
) }
~~~~~~~~~~~~~
{ 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?
<h1>{ user.Name }</h1>
) }
</FetchUser>
);
}
Loading