gen_js_api icon indicating copy to clipboard operation
gen_js_api copied to clipboard

Contravariant type parameter 'a is not allowed

Open Lupus opened this issue 4 years ago • 0 comments

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? 🤔

Lupus avatar Sep 24 '21 14:09 Lupus