Closed
Description
TypeScript Version: 3.2.0-rc, 9319ea4
Search Terms:
Pick, keyof
Code
interface Foo {
a: number;
b: boolean;
}
const SomeFunc = <K extends keyof Foo>(
state: Pick<Foo, K>
) => {
if (state.a) {
state.b = true;
}
};
Expected behavior:
No error (passes in 3.1.6)
Actual behavior:
src/example.ts:17:15 - error TS2339: Property 'a' does not exist on type 'Pick<Foo, K>'.
17 if (state.a) {
~
src/example.ts:19:15 - error TS2339: Property 'b' does not exist on type 'Pick<Foo, K>'.
19 state.b = true;
Playground Link:
Related Issues:
Possibly related to #28647, but I'm unsure.