-
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.
[flow][get-def] Special case get-def for Pick with string literals in…
… the second targ Summary: Changelog: [ide] For `Pick` utility type with string literals in the second type argument, go-to-definition on the string literal will jump to corresponding prop's location Reviewed By: gkz Differential Revision: D60403582 fbshipit-source-id: 48bbfc4371a7d163fcd8efdca51b0e07d5488212
- Loading branch information
1 parent
a50bef2
commit 6680c15
Showing
6 changed files
with
124 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow | ||
|
||
type Obj = {foo: string, bar: number}; | ||
|
||
function locally_defined_pick() { | ||
type Pick<A, B> = A; | ||
|
||
type T = Pick<Obj, 'foo'>; // no result for locally defined pick | ||
// ^ | ||
} | ||
|
||
type T1 = Pick<Obj, 'foo'>; // jump to foo prop | ||
// ^ | ||
type T2 = Pick<Obj, 'bar'>; // jump to bar prop | ||
// ^ | ||
type Foo = 'foo'; | ||
type T3 = Pick<Obj, Foo>; // jump to type Foo, instead of jumping to foo prop | ||
// ^ | ||
|
||
type T4 = Pick<Obj, 'foo' | 'bar'>; // jump to foo prop | ||
// ^ | ||
type T5 = Pick<Obj, 'foo' | 'bar'>; // jump to bar prop | ||
// ^ | ||
type T6 = Pick<Obj, Foo | 'bar'>; // jump to bar prop | ||
// ^ |
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