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
Idea: constrained types with a round-trippable string representation can be inferred for infers in template strings when you enforce a constraint with something like type Is<T extends U, U> = T (or the constraint feature mentioned above).
If you can get away with Is<T extends U, U> = T, do we really need to add syntax?
Well we don't feel good about people having to learn this.
Also, you can avoid those nested conditional checks.
The text was updated successfully, but these errors were encountered:
extends
Constraints oninfer
Type Parameters#48112
Was using a separate type alias to constrain an
infer
type parameter.Required little to no changes; scope felt small.
Means you can avoid levels of cascading.
Could achieve some of this with a type alias
What about a
[infer T, infer U extends T]
?Need to think through whether there's weirdness here.
In theory shouldn't have any weirdness compared to regular type parameters.
Right now the
infer
parameters are not in scope with respect to each other.Parsing issues that could break existing code?
infer
in the checked type? wtf does this mean?Could say "you need to parenthesize
infer P
"So there's at least an ambiguity. Could get away with some speculative parsing to disambiguate.
Another test case: make sure that an outer type parameter used in a constraint works.
infer
Improvements in Template Literal Types#48094
infer
s in template strings when you enforce a constraint with something liketype Is<T extends U, U> = T
(or the constraint feature mentioned above).Is<T extends U, U> = T
, do we really need to add syntax?The text was updated successfully, but these errors were encountered: