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
generic parameter for interface as another generic interface
generic interface parameter nesting
generic interface with proxied generic parameter
Suggestion
I would like to be able to define a generic interface T where X would be another generic interface and to be able to restrict how many generic parameters it would provide. Maybe best I could write it as interface T<X<any>> to require 1 generic type with 1 generic parameter, but that parameter would have to be added not in the declaration of the interface but in the declarations inside the body of the interface.
Use Cases
An example use case would be of having a provider that serves some types A, B, C wrapped in another object that can have a generic type ParameterBag.
Is there a typescript vocabulary that gives all of these words for the generic typing specifics? Searching for existing issue for this was hard for me because I was not able to construct with proper names what I would like.
Is there a typescript vocabulary that gives all of these words for the generic typing specifics? Searching for existing issue for this was hard for me because I was not able to construct with proper names what I would like.
Not that I know of; the only reason I knew this was a duplicate is because I remembered the existing issue. In other languages this is usually called "higher kinded types" but I don't know if there's a single canonical terminology for this or anything else in TypeScript.
Search Terms
generic parameter for interface as another generic interface
generic interface parameter nesting
generic interface with proxied generic parameter
Suggestion
I would like to be able to define a generic interface T where X would be another generic interface and to be able to restrict how many generic parameters it would provide. Maybe best I could write it as
interface T<X<any>>
to require 1 generic type with 1 generic parameter, but that parameter would have to be added not in the declaration of the interface but in the declarations inside the body of the interface.Use Cases
An example use case would be of having a provider that serves some types A, B, C wrapped in another object that can have a generic type ParameterBag.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: