diff --git a/src/FsCodec.SystemTextJson/UnionOrTypeSafeEnumConverterFactory.fs b/src/FsCodec.SystemTextJson/UnionOrTypeSafeEnumConverterFactory.fs index 208e218..f6eba02 100644 --- a/src/FsCodec.SystemTextJson/UnionOrTypeSafeEnumConverterFactory.fs +++ b/src/FsCodec.SystemTextJson/UnionOrTypeSafeEnumConverterFactory.fs @@ -12,8 +12,7 @@ type UnionOrTypeSafeEnumConverterFactory(typeSafeEnum, union) = static let hasConverterAttribute = memoize (fun (t: Type) -> t.IsDefined(typeof, true)) override _.CanConvert(t: Type) = - t.IsGenericType - && not (let gtd = t.GetGenericTypeDefinition() in gtd = typedefof> || gtd = typedefof>) + not (t.IsGenericType && let gtd = t.GetGenericTypeDefinition() in gtd = typedefof> || gtd = typedefof>) && FsCodec.Union.isUnion t && not (hasConverterAttribute t) && ((typeSafeEnum && union)