Closed agubler closed 7 years ago
Related error:
Code:
type TypeA = {
foo: string;
bar: string;
};
const thingA = {
foo: 'foo',
bar: 'bar'
};
const thingB = {
bar: 'baz'
};
const result: TypeA = lang.assign({}, thingA, thingB);
Expected: Compile Successfully
Actual:
The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'TypeA' is not a valid type argument because it is not a supertype of candidate '{ bar: string; }'. Property 'foo' is missing in type '{ bar: string; }'.
This is pretty important, now that we have the types to model it. Bumping the priority on it.
The sources for assign/mixin functions should be typed so that subsequent sources can contain attributes that are not included in the first
source
. At the moment compile errors occurs if the second source expands the keys compared to the initialsource
.Code:
Expected:
Compile successfully
Actual:
error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ foo: string; }' is not a valid type argument because it is not a supertype of candidate '{ baz: string; }'. Object literal may only specify known properties, and 'baz' does not exist in type '{ foo: string; }'.