You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a should type-check: it constrains foo to 'bar' but is given 'typo'.
b should type-check: it requires foo but is given an object without foo.
Actual behavior:
Neither type-check.
The same types check fine when resolved directly:
// Type '{ foo: "typo"; }' is not assignable to type '{ foo: "bar"; }'.// Types of property 'foo' are incompatible.// Type '"typo"' is not assignable to type '"bar"'.consta: {foo: 'bar'}={foo: 'typo'});// Type '{}' is not assignable to type '{ foo: "bar"; }'.// Property 'foo' is missing in type '{}'.constb: {foo: 'bar'}={};
Generic parameter type checks fail for objects/types of different shapes:
// Type 'Promise<{ foo: string; bar: string; }>' is not assignable to type 'Promise<{ foo: "bar"; }>'.// Type '{ foo: string; bar: string; }' is not assignable to type '{ foo: "bar"; }'.// Types of property 'foo' are incompatible.// Type 'string' is not assignable to type '"bar"'.consta: Promise<{foo: 'bar'}>=Promise.resolve({foo: 'bar',bar: 'baz'});// Type 'Promise<number>' is not assignable to type 'Promise<{ foo: "bar"; }>'.// Type 'number' is not assignable to type '{ foo: "bar"; }'.constb: Promise<{foo: 'bar'}>=Promise.resolve(1);
The text was updated successfully, but these errors were encountered:
stephencelis
changed the title
Promise.resolve doesn't fully type-check generic parameters
Generic parameters not fully type-checked (e.g., Promise)
Mar 21, 2017
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 2.2.1
Code
Expected behavior:
a
should type-check: it constrainsfoo
to'bar'
but is given'typo'
.b
should type-check: it requiresfoo
but is given an object withoutfoo
.Actual behavior:
Neither type-check.
The same types check fine when resolved directly:
Generic parameter type checks fail for objects/types of different shapes:
The text was updated successfully, but these errors were encountered: