-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flow opaque type 6.x backport (#6081)
* Flow opaque type backport * Add tests for strip types, comments, and babel-generator * Fix failing tests, run scripts * Bump babylon to 6.18.0
- Loading branch information
Showing
16 changed files
with
353 additions
and
78 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,6 @@ | |
}, | ||
"devDependencies": { | ||
"babel-helper-fixtures": "^6.22.0", | ||
"babylon": "^6.17.2" | ||
"babylon": "^6.18.0" | ||
} | ||
} |
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
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
14 changes: 14 additions & 0 deletions
14
packages/babel-generator/test/fixtures/flow/opaque-type-alias/actual.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,14 @@ | ||
opaque type ID = string; | ||
opaque type Foo<T> = Bar<T>; | ||
opaque type Maybe<T> = _Maybe<T, *>; | ||
export opaque type Foo = number; | ||
|
||
opaque type union = | ||
| {type: "A"} | ||
| {type: "B"} | ||
; | ||
|
||
opaque type overloads = | ||
& ((x: string) => number) | ||
& ((x: number) => string) | ||
; |
8 changes: 8 additions & 0 deletions
8
packages/babel-generator/test/fixtures/flow/opaque-type-alias/expected.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,8 @@ | ||
opaque type ID = string; | ||
opaque type Foo<T> = Bar<T>; | ||
opaque type Maybe<T> = _Maybe<T, *>; | ||
export opaque type Foo = number; | ||
|
||
opaque type union = { type: "A" } | { type: "B" }; | ||
|
||
opaque type overloads = (x: string) => number & (x: number) => string; |
15 changes: 15 additions & 0 deletions
15
...el-plugin-transform-flow-comments/test/fixtures/flow-comments/opaque-type-alias/actual.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,15 @@ | ||
function a() {} | ||
opaque type A = number; | ||
opaque type B = { | ||
name: string; | ||
}; | ||
|
||
opaque type union = | ||
| {type: "A"} | ||
| {type: "B"} | ||
; | ||
|
||
opaque type overloads = | ||
& ((x: string) => number) | ||
& ((x: number) => string) | ||
; |
13 changes: 13 additions & 0 deletions
13
...-plugin-transform-flow-comments/test/fixtures/flow-comments/opaque-type-alias/expected.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,13 @@ | ||
function a() {} | ||
/*:: opaque type A = number;*/ | ||
/*:: opaque type B = { | ||
name: string; | ||
};*/ | ||
/*:: opaque type union = | ||
| {type: "A"} | ||
| {type: "B"} | ||
;*/ | ||
/*:: opaque type overloads = | ||
& ((x: string) => number) | ||
& ((x: number) => string) | ||
;*/ |
16 changes: 16 additions & 0 deletions
16
...in-transform-flow-strip-types/test/fixtures/strip-types/strip-opaque-type-alias/actual.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,16 @@ | ||
opaque type ID = string; | ||
opaque type Foo<T> = Bar<T> | ||
export opaque type Foo = number; | ||
|
||
opaque type union = | ||
| {type: "A"} | ||
| {type: "B"} | ||
; | ||
|
||
opaque type overloads = | ||
& ((x: string) => number) | ||
& ((x: number) => string) | ||
; | ||
|
||
declare opaque type Foo: Bar; | ||
declare export opaque type Foo: Bar; |
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
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 |
---|---|---|
|
@@ -15,6 +15,6 @@ | |
}, | ||
"devDependencies": { | ||
"babel-generator": "^6.22.0", | ||
"babylon": "^6.17.2" | ||
"babylon": "^6.18.0" | ||
} | ||
} |
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