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
ts-check has allowed error suppression with // @ts-ignore comments.
We've not wanted to add this because in most cases, people have just needed simple fixes.
More motivating case: in large codebases, parts are unmaintained but broken.
Code still works, but doesn't type-check, but who will
Do we want to allow descriptive text after ts-ignore?
Maybe don't allow the colon.
Conclusion: Just allow the colon, let's do it.
Variance
Have thought about a --strictFunctionTypes mode, and have an experimental implementation.
Under this flag, when relating "function types" (but not methods!), parameters are related contravariantly.
Does a "function type" include an object type with call signatures?
Yes.
Currently placed under the --strict family of compiler options.
It's not 100% of the way, but it gets you much closer.
Under this mode
New subtlety - right now when we relate between type references, we relate their type parameters covariantly because parameter types will be related covariantly.
But we can no longer make this assumption.
To do a simple check, just fathom up a type and a known subtype, perform instantiation of the types, and relate them.
What about many type parameters?
Keep the arguments the same, flip each of them to test each type parameter's variance.
What about constraints on type parameters?
We might need to think more deeply about it.
Tried it on the compiler and real world code, and found mostly good errors.
Also to examine: when doing type arg inference, we need to find the best common subtype, not the best common supertype.
Will we produce an intersection?
No, we'll try to still choose a type from the set of candidate types inferred.
May need to revisit rules for overload/implementation relation checking?
Error Suppression
#18457
ts-check
has allowed error suppression with// @ts-ignore
comments.ts-ignore
?Variance
--strictFunctionTypes
mode, and have an experimental implementation.--strict
family of compiler options.Mapped types to allow numeric constraint types
#18346
number
outside of thekeyof
type.number
in the position of the iterated type in a mapped type.string
-indexer instead?tokey
type operator? That might make relations easier to reason about.Nominal types
instanceof
to work correctly.The text was updated successfully, but these errors were encountered: