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
This is a supplementing proposal to go with my constraint types proposal: #13257, but it also could be very powerful for working with the typeof proposal in #6606.
In that proposal, there is the ability to dispatch type based on value is Whatever, and it would be useful to also generically pass bindings (not just raw types).
Proposal
// DeclarationinterfaceFoo<exprvalue>{}typeFoo<exprvalue>= ...
// Declaration with constraintsinterfaceFoo<exprvalue is Bar>{}typeFoo<exprvalue is Bar>= ...
// Usageconst foo: Foo<foo>;declarefunctionbar(item: any): Foo<item>interfaceBar{self: Foo<this>;}
In declarations, you simply prefix expr to make it a value-level binding rather than a type.
You may constrain these with the same value is T syntax currently available in return values.
Using them is as simple as passing a variable name as a parameter.
Any typeof operand supported is also supported here as a generic parameter.
this is a valid binding.
The text was updated successfully, but these errors were encountered:
This is a supplementing proposal to go with my constraint types proposal: #13257, but it also could be very powerful for working with the
typeof
proposal in #6606.In that proposal, there is the ability to dispatch type based on
value is Whatever
, and it would be useful to also generically pass bindings (not just raw types).Proposal
expr
to make it a value-level binding rather than a type.value is T
syntax currently available in return values.typeof
operand supported is also supported here as a generic parameter.this
is a valid binding.The text was updated successfully, but these errors were encountered: