-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesThe issue relates to conditional typesDomain: Mapped TypesThe issue relates to mapped typesThe issue relates to mapped typesFixedA PR has been merged for this issueA PR has been merged for this issue
Description
TypeScript Version:
typescript@3.2.0-dev.20181011
typescript@3.1.3
typescript@3.0.3
Search Terms:
Code
type Baa = { a: number, b: number };
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
function foo<P extends Baa>() {
const foo: { foo: string } & Omit<P, 'b'> = null as any;
const props: Baa = foo;
}Expected behavior:
No error.
Actual behavior:
test.ts:6:11 - error TS2322: Type '{ foo: string; } & Pick<P, Exclude<keyof P, "b">>' is not assignable to type 'Baa'.
Property 'a' is missing in type '{ foo: string; } & Pick<P, Exclude<keyof P, "b">>'.
6 const props: Baa = foo;
~~~~~
Removing the { foo: string } & works.
Removing the Omit works.
Removing the P and using Baa directly works.
Playground Link:
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesThe issue relates to conditional typesDomain: Mapped TypesThe issue relates to mapped typesThe issue relates to mapped typesFixedA PR has been merged for this issueA PR has been merged for this issue