Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react] deprecate $Supertype and $Subtype
Summary: This bans the utility types `$Supertype` and `$Subtype` from Flow. These utilities are unsound and can usually be modeled using shapes or bounded generics. This also changes the types of the proptypes from `lib/react.js` to `any`, since these relied on `$Subtype`. Reviewed By: jbrown215 Differential Revision: D13244153 fbshipit-source-id: cd82d603b4ada59b792832ce0bcfbc14bc667914
- Loading branch information
1 parent
5f25cfb
commit d935071
Showing
15 changed files
with
79 additions
and
38 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
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
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,5 @@ | |||
[options] | [options] | ||
no_flowlib=false | no_flowlib=false | ||
|
|||
[lints] | |||
deprecated-utility=error |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
[ignore] | |||
|
|||
[include] | |||
|
|||
[libs] | |||
|
|||
[options] | |||
|
|||
[lints] | |||
deprecated-utility=error |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
Error ------------------------------------------------------------------------------------------------------ test.js:3:9 | |||
|
|||
Deprecated utility. Using `$Supertype` types is not recommended! (`deprecated-utility`) | |||
|
|||
3| let x : $Supertype<number> = 3; | |||
^^^^^^^^^^^^^^^^^^ | |||
|
|||
|
|||
Error ------------------------------------------------------------------------------------------------------ test.js:4:9 | |||
|
|||
Deprecated utility. Using `$Subtype` types is not recommended! (`deprecated-utility`) | |||
|
|||
4| let y : $Subtype<number> = 3; | |||
^^^^^^^^^^^^^^^^ | |||
|
|||
|
|||
|
|||
Found 2 errors |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
// @flow | |||
|
|||
let x : $Supertype<number> = 3; | |||
let y : $Subtype<number> = 3; |
Oops, something went wrong.