如何在寓言中扩展 JS class

How to extend a JS class in fable

给定一个在外部 JS 库中定义的 class(我们称它为 Foo)然后我想在 F# 中扩展

type bar() = 
   inherits Foo
   ...

但是我只能找到如何与函数集成的示例

[<Import("Foo", from="my-module")>]
let Foo = JsNative

当然不会让我从Foo派生Bar。那我该怎么做

Import 属性可用于 type 声明。例如

[<Import("Foo", from="my-module")>]
type Foo() =
    class
    end

type Bar() =
    inherit Foo()

然后您还可以包括 class 成员的签名。查看 Fable React 声明等导入示例很有启发性:https://github.com/fable-compiler/fable-react/blob/master/src/Fable.React/Fable.Import.React.fs