-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react] reserve React$AbstractComponent
Summary: Adds React$AbstractComponent as a built-in that expects 3 type arguments. I'll be building out the functionality of this type in stacked diffs. OSS Users: I will follow up with a blog post when we get closer to having this type actually be usable. We expect it to improve the precision and speed with which flow can typecheck React components. Reviewed By: samwgoldman Differential Revision: D12925858 fbshipit-source-id: e242dbf74ed2b90eca3fb7f66641bee8b919e530
- Loading branch information
1 parent
d0ac7d9
commit 16dc39a
Showing
6 changed files
with
62 additions
and
0 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
Empty file.
34 changes: 34 additions & 0 deletions
34
tests/react_abstract_component/react_abstract_component.exp
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,34 @@ | ||
Error ----------------------------------------------------------------------------------------------------- test.js:3:19 | ||
|
||
React$AbstractComponent is not supported yet. | ||
|
||
3| function test1(x: React$AbstractComponent<any, any, any>) { // Error not yet supported | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
|
||
Error ----------------------------------------------------------------------------------------------------- test.js:7:19 | ||
|
||
Cannot use type without exactly 3 type arguments. | ||
|
||
7| function test2(x: React$AbstractComponent<any>) { // Not enough targs | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
|
||
Error ---------------------------------------------------------------------------------------------------- test.js:11:19 | ||
|
||
Cannot use type without exactly 3 type arguments. | ||
|
||
11| function test3(x: React$AbstractComponent<any,any>) { // Not enough targs | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
|
||
Error ---------------------------------------------------------------------------------------------------- test.js:15:19 | ||
|
||
Cannot use type without exactly 3 type arguments. | ||
|
||
15| function test4(x: React$AbstractComponent<any,any,any,any>) { // Too many targs | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
|
||
|
||
Found 4 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@flow | ||
|
||
function test1(x: React$AbstractComponent<any, any, any>) { // Error not yet supported | ||
return x; | ||
} | ||
|
||
function test2(x: React$AbstractComponent<any>) { // Not enough targs | ||
return x; | ||
} | ||
|
||
function test3(x: React$AbstractComponent<any,any>) { // Not enough targs | ||
return x; | ||
} | ||
|
||
function test4(x: React$AbstractComponent<any,any,any,any>) { // Too many targs | ||
return x; | ||
} |