-
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.
Reviewed By: samwgoldman Differential Revision: D5222718 fbshipit-source-id: de926de63a6c4f42b47929bfbbc3b20f5a094777
- Loading branch information
1 parent
325c136
commit 968210c
Showing
8 changed files
with
63 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type BadArity = $ElementType<number, number, number>; | ||
|
||
type Arr = Array<number>; | ||
type Arr_Elem = $ElementType<Arr, number>; | ||
|
||
(42: Arr_Elem); // OK: `Arr_Elem` is `number` | ||
('hello world': Arr_Elem); | ||
|
||
function foo(a: Arr): $ElementType<Arr, number> { | ||
if (false) return a[0]; | ||
else return 0; | ||
} | ||
|
||
type Obj = { [key: string]: number }; | ||
type Obj_Elem = $ElementType<Obj, string>; | ||
|
||
(42: Obj_Elem); // OK: `Obj_Elem` is `number` | ||
('hello world': Obj_Elem); | ||
|
||
function bar(o: Obj): $ElementType<Obj, string> { | ||
if (false) return o['buz']; | ||
else return 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