We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre 1.0, used to be that we could allow you to write something like class Foo<T extends X, U extends T>
class Foo<T extends X, U extends T>
T
class Foo<T extends Foo<T>> { }
though this is solved.
function bar<T extends Foo<T>>(x: T): T { }
when writing bar(expr), we expect to infer a types of T from expr. We then need to check the constraint for T against Foo<T>.
bar(expr)
expr
Foo<T>
any
T extends Foo<T>
Foo<{}>
Inferring from union types
function extract<T>(x: T | string): T { /*...*/ } var x: string | string[]; var y = extract(x);
string
string[]
function extract<T>(x: T | string): T { var z = extract(x); }
* Right now we refer the type of `z` to be `{}`. * Changes to union type inference will make us infer the type of `z` to be `T`.
Regression caused by implicit type parameters
class C { } var x: C;
is implicitly of like writing
class C<this> { } var x: C<C>;
C
TypeFlags.Class
TypeFlags.Reference
.d.ts
Direction.Right
Moral.Right
Direction
Moral
Volume
Weight
The text was updated successfully, but these errors were encountered:
Team seems frightened by this, I will never bring this up again.
😨
Sorry, something went wrong.
No branches or pull requests
Allow type parameter constraints to reference other type parameters (#2304)
Pre 1.0, used to be that we could allow you to write something like
class Foo<T extends X, U extends T>
T
here?though this is solved.
when writing
bar(expr)
, we expect to infer a types ofT
fromexpr
.We then need to check the constraint for
T
againstFoo<T>
.any
when we can't resolve things?any
for almost every type parameter of this form which is undesirableT extends Foo<T>
withFoo<{}>
Inferring from union types
string
from the union type and just inferstring[]
forT
.Regression caused by implicit type parameters
is implicitly of like writing
C
has type flags indicating that it is both a class and a reference (TypeFlags.Class
andTypeFlags.Reference
).Enum compatibility - continued (#1748)
.d.ts
that they depend on.Direction.Right
toMoral.Right
, we need to check ifDirection
andMoral
are structurally compatible as well.Volume
andWeight
to be compatible.The text was updated successfully, but these errors were encountered: