Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add assertions signature for TypeScript (#10543)
* add asserts predicate * fix flow * babel-generator for typescript assertions * babel-types for typescript assertions * asserts modifier as boolean
- Loading branch information
1 parent
4cd93ab
commit 38a3063
Showing
19 changed files
with
1,721 additions
and
17 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
packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js
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 @@ | ||
(x: any): asserts x => true; | ||
(x: any): asserts x is boolean => true; |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js
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,3 @@ | ||
(x: any): asserts x => true; | ||
|
||
(x: any): asserts x is boolean => true; |
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/typescript/function-assertion/input.js
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 f(x: any): asserts x {} | ||
(function(x: any): asserts x is boolean {}) |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/typescript/function-assertion/output.js
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,3 @@ | ||
function f(x: any): asserts x {} | ||
|
||
(function (x: any): asserts x is boolean {}); |
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
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
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/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,3 @@ | ||
const assert1 = (value: unknown): asserts value is string => {} | ||
const assert2 = (value: unknown): asserts value => {} | ||
const assert3 = (value: unknown): asserts => {} |
Oops, something went wrong.