Skip to content

Contravariant type parameter 'a is not allowed #155

@Lupus

Description

@Lupus

I'm trying to bind the following TypeScript definition:

export type ValueCallback<T> = (err: Error, val: T) => void;

Naive approach results in this error:

File "out.mli", line 8, characters 36-38:
8 | type 'a value_callback = Error.t -> 'a -> unit
                                        ^^
Error: Contravariant type parameter 'a is not allowed.

I'm wondering why can't existing support for type parameters be extended for this case? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions