-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JS/TS] Fix TypeScript compilation by resolving type of
jsOptions
(#…
…3894) * [JS/TS] Fix TypeScript compilation by resolving type of `jsOptions` Fix #3891 * chore: add changelog entry
- Loading branch information
1 parent
15878c6
commit 0bb4ff2
Showing
8 changed files
with
61 additions
and
5 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
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
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
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
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
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
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,37 @@ | ||
module Fable.Tests.LiteTsInterop | ||
|
||
open System | ||
open Util.Testing | ||
open Fable.Core | ||
|
||
#if FABLE_COMPILER | ||
open Fable.Core.JsInterop | ||
open Fable.Core.DynamicExtensions | ||
open Fable.Core.Experimental | ||
#endif | ||
|
||
type JsOptions = | ||
abstract foo: string with get, set | ||
abstract bar: int with get, set | ||
let tests = | ||
testList "LiteTsInterop" [ | ||
#if FABLE_COMPILER | ||
testCase "jsOptions works" <| fun _ -> | ||
let opts = jsOptions<JsOptions>(fun o -> | ||
o.foo <- "bar" | ||
o.bar <- 5 | ||
) | ||
opts.foo |> equal "bar" | ||
opts.bar |> equal 5 | ||
|
||
testCase "jsOptions works when it is directly replaced as a POJO" <| fun () -> | ||
let opts = jsOptions<JsOptions>(fun o -> | ||
// This function call avoid the optimization to literal POJO | ||
let foo () = "foo" | ||
o.foo <- foo() | ||
o.bar <- 5 | ||
) | ||
opts.foo |> equal "foo" | ||
opts.bar |> equal 5 | ||
#endif | ||
] |
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