Skip to content

Commit

Permalink
Convert unresolved type reference in Union to obj
Browse files Browse the repository at this point in the history
  • Loading branch information
MangelMaxime committed Dec 3, 2023
1 parent e471620 commit 2b99a6a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Glutinum.Converter/Read.fs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,15 @@ let rec private readUnionTypeCases

readNode checker declaration |> List.singleton |> Some

| None -> failwith "readUnionTypeCases: Unsupported type reference"
| None ->
let typ = checker.getTypeOfSymbol symbol

if TypeFlags.hasFlag typ.flags Ts.TypeFlags.Any then
GlueType.Primitive GluePrimitive.Any
|> List.singleton
|> Some
else
failwith "readUnionTypeCases: Unsupported type reference"

// else
// symbol.declarations
Expand Down
5 changes: 5 additions & 0 deletions tests/specs/class/membersWithUnkownTypeReference.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class Dayjs {
constructor();

locale(preset: string | ILocale): Dayjs;
}
17 changes: 17 additions & 0 deletions tests/specs/class/membersWithUnkownTypeReference.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module rec Glutinum

(***)
#r "nuget: Fable.Core"
(***)

open Fable.Core
open System

[<Erase>]
type Exports =
[<Import("Dayjs", "module"); EmitConstructor>]
static member Dayjs () : Dayjs = nativeOnly

[<AllowNullLiteral>]
type Dayjs =
abstract member locale: preset: U2<string, obj> -> Dayjs

0 comments on commit 2b99a6a

Please sign in to comment.