-
-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Note
This is reproduction code
type IDecoderHelpers<'JsonValue> =
abstract isString: 'JsonValue -> bool
abstract asString: 'JsonValue -> string
type Decoder<'T> =
abstract member Decode<'JsonValue> :
helpers: IDecoderHelpers<'JsonValue> * value: 'JsonValue -> obj
let invalidGenerics: Decoder<string> =
{ new Decoder<string> with
member _.Decode(helpers, value) =
null
}
let correctGenerics: Decoder<string> =
{ new Decoder<string> with
member _.Decode<'JsonValue>(helpers : IDecoderHelpers<'JsonValue>, value) =
null
}import { defaultOf } from "fable-library-js/Util.js";
export interface IDecoderHelpers$1<JsonValue> {
asString(arg0: JsonValue): string,
isString(arg0: JsonValue): boolean
}
export interface Decoder$1<T> {
Decode<JsonValue>(helpers: IDecoderHelpers$1<JsonValue>, value: JsonValue): any
}
export const invalidGenerics: Decoder$1<string> = {
Decode<JsonValue>(helpers: IDecoderHelpers$1<$a>, value: $a): any {
return defaultOf();
},
};
export const correctGenerics: Decoder$1<string> = {
Decode<JsonValue>(helpers: IDecoderHelpers$1<JsonValue>, value: JsonValue): any {
return defaultOf();
},
};See how the invalidGenerics is using $a instead of JsonValue.
This problem was first reported on Fable repository fable-compiler/Fable#3586 and in private to me.
We should fix this in Fable, but to workaround this issue it is possible to help the compiler infer the correct generics name. In order, to catch all occurence of this issues and make sure Thoth.Json.Core and Thoth.Json.JavaScript can be used on TypeScript, we should also run the tests against TypeScript.
goswinr
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working