-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: forward generics to the generated types when transforming a `Typ…
…eLiteral` [converter] === changelog === ```ts export type Callback<Param, AtomType> = (event: { atom: AtomType; }) => void; ``` ```fs [<AllowNullLiteral>] [<Interface>] type Callback<'Param, 'AtomType> = [<Emit("$0($1...)")>] abstract member Invoke: event: Callback.event<'AtomType> -> unit module Callback = [<Global>] [<AllowNullLiteral>] type event<'AtomType> [<ParamObject; Emit("$0")>] ( atom: 'AtomType ) = member val atom : 'AtomType = nativeOnly with get, set ``` Fix #148
- Loading branch information
1 parent
eecbbc6
commit e0039f4
Showing
3 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/specs/references/typeLiteral/functionType/generics.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type Callback<Param, AtomType> = (event: { | ||
type: 'CREATE' | 'REMOVE'; | ||
param: Param; | ||
atom: AtomType; | ||
}) => void; |
40 changes: 40 additions & 0 deletions
40
tests/specs/references/typeLiteral/functionType/generics.fsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module rec Glutinum | ||
|
||
open Fable.Core | ||
open Fable.Core.JsInterop | ||
open System | ||
|
||
[<AllowNullLiteral>] | ||
[<Interface>] | ||
type Callback<'Param, 'AtomType> = | ||
[<Emit("$0($1...)")>] | ||
abstract member Invoke: event: Callback.event<'Param, 'AtomType> -> unit | ||
|
||
module Callback = | ||
|
||
[<Global>] | ||
[<AllowNullLiteral>] | ||
type event<'Param, 'AtomType> | ||
[<ParamObject; Emit("$0")>] | ||
( | ||
``type``: Callback.event.``type``, | ||
param: 'Param, | ||
atom: 'AtomType | ||
) = | ||
|
||
member val ``type`` : Callback.event.``type`` = nativeOnly with get, set | ||
member val param : 'Param = nativeOnly with get, set | ||
member val atom : 'AtomType = nativeOnly with get, set | ||
|
||
module event = | ||
|
||
[<RequireQualifiedAccess>] | ||
[<StringEnum(CaseRules.None)>] | ||
type ``type`` = | ||
| CREATE | ||
| REMOVE | ||
|
||
(***) | ||
#r "nuget: Fable.Core" | ||
#r "nuget: Glutinum.Types" | ||
(***) |