Fable icon indicating copy to clipboard operation
Fable copied to clipboard

IsUnion returns false for typeof<Option<int>>

Open kerams opened this issue 5 years ago • 2 comments

Description

Reflection.FSharpType.IsUnion typeof<Option<int>> returns false.

Expected and actual results

Expecting true like on .NET.

Related information

  • Fable version: Online REPL

kerams avatar Jun 30 '20 08:06 kerams

Yes, in Fable option is a special type and is not like other unions. Although I guess we could fix it in the reflection info. https://github.com/fable-compiler/Fable/blob/7d02d3e690a9b15cb7ca823b90c20f46f13f2a37/src/fable-library/Reflection.ts#L111-L113

Do you have an example of a scenario that's being blocked by this?

alfonsogarciacaro avatar Jul 01 '20 14:07 alfonsogarciacaro

https://github.com/Zaid-Ajaj/Fable.Remoting/pull/158/files#diff-5bdc4da2122faa430fe9e2f88bdb24e6R425

Not really a blocker since one can always specifically typecheck for Option.

kerams avatar Jul 01 '20 14:07 kerams