Closed
Description
π Search Terms
generic, class, infer
π Version & Regression Information
β― Playground Link
π» Code
export type Assign<T, U> = Omit<T, keyof U> & U;
class Foo<T> {
constructor(public t: T) {}
assign(u: {x: 1}): Foo<Assign<T, {x: 1}>> {
const v: Assign<T, {x: 1}> = Object.assign({}, this.t, u);
return new Foo(v);
// ^?
// Type 'Foo<Assign<Assign<T, { x: 1; }>, { x: 1; }>>' is not assignable to type 'Foo<Assign<T, { x: 1; }>>'.
// wat
}
}
π Actual behavior
Type error
π Expected behavior
No type error
Additional information about the issue
No response