Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(babel-parser): Allow line break before
assert
return type (#13771)
- Loading branch information
1 parent
8fb5042
commit da79c90
Showing
3 changed files
with
187 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...r/test/fixtures/typescript/assert-predicate/function-declaration-with-line-break/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
function assert(condition: any): | ||
asserts condition {} |
184 changes: 184 additions & 0 deletions
184
...est/fixtures/typescript/assert-predicate/function-declaration-with-line-break/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 53, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 20 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 53, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 20 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start": 0, | ||
"end": 53, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 20 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 9, | ||
"end": 15, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
}, | ||
"identifierName": "assert" | ||
}, | ||
"name": "assert" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start": 16, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
}, | ||
"identifierName": "condition" | ||
}, | ||
"name": "condition", | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start": 25, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 25 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
} | ||
}, | ||
"typeAnnotation": { | ||
"type": "TSAnyKeyword", | ||
"start": 27, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 27 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 30 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"returnType": { | ||
"type": "TSTypeAnnotation", | ||
"start": 31, | ||
"end": 50, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 31 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 17 | ||
} | ||
}, | ||
"typeAnnotation": { | ||
"type": "TSTypePredicate", | ||
"start": 33, | ||
"end": 50, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 17 | ||
} | ||
}, | ||
"parameterName": { | ||
"type": "Identifier", | ||
"start": 41, | ||
"end": 50, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 17 | ||
}, | ||
"identifierName": "condition" | ||
}, | ||
"name": "condition" | ||
}, | ||
"asserts": true, | ||
"typeAnnotation": null | ||
} | ||
}, | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 51, | ||
"end": 53, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 18 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 20 | ||
} | ||
}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |