Skip to content

Generic that extends a type with a generic #5929

@bgrieder

Description

@bgrieder

Say I have an interface

interface Applicative<T> {}

Now I want to define a function f that:

  • takes a Function and takes a type U extending an Applicative wrapping any
  • returns an U wrapping Function

My naive attempts were

  function f<U extends Applicative>(fn: Function, a: U<any>): U<Function>

and

  function f<T, U<T> extends Applicative<T>>(fn: Function, a: U<any>): U<Function>

but none is valid

Can we have a Generic extend a type with a generic ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions