-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.4.0-dev.20190310
Search Terms:
Resolve / flatten / simplify type aliases for function calls
resolve type aliases
Code
let subject = {a:1,b:2,c:3,d:4}
type thisResolves = Pick<typeof subject, 'a' | 'b'>
let thisDoesnt = pick(subject, ['a', 'b'])
declare function pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T,K>Expected behavior:
The Quick Info type of thisDoesnt resolves to { a: number, b: number}
Actual behavior:
The Quick Info type of thisDoesnt resolves to Pick<{ a: number, b: number, c: number, d: number}, 'a' | 'b'>
Playground Link: here
Related Issues:
I've seen in other issues that type aliases are eagerly resolved (e.g. #13095 (comment) and #16798 (comment)). This is a case where that behavior is useful, since reading through a lot of Pick<Foo<Bar<... in VS Code makes it difficult to figure out the true source of a type error.
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript