Skip to content

Commit

Permalink
Add support for TypePredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
MangelMaxime committed Dec 3, 2023
1 parent 2b99a6a commit 4f2e3a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Glutinum.Converter/Read.fs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ let private readTypeNode

GlueType.Array elementType

| Ts.SyntaxKind.TypePredicate ->
GlueType.Primitive GluePrimitive.Bool

| _ -> failwith $"readTypeNode: Unsupported kind {typeNode.kind}"
| None -> GlueType.Primitive GluePrimitive.Unit

Expand Down
1 change: 1 addition & 0 deletions tests/specs/typePredicate/convertedToBool.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function isDayjs(d: any): d is Dayjs
13 changes: 13 additions & 0 deletions tests/specs/typePredicate/convertedToBool.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module rec Glutinum

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

open Fable.Core
open System

[<Erase>]
type Exports =
[<Import("isDayjs", "module")>]
static member isDayjs (d: obj) : bool = nativeOnly

0 comments on commit 4f2e3a6

Please sign in to comment.