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.
TypeScript Version: 3.4.0-dev.20190310
Search Terms:
Resolve / flatten / simplify type aliases for function calls
resolve type aliases
Code
Expected behavior:
The Quick Info type of
thisDoesntresolves to{ a: number, b: number}Actual behavior:
The Quick Info type of
thisDoesntresolves toPick<{ 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.