WebExtensions实验API schema.json转换为Typescript声明

问题描述

我想将自己的WebExtensions Experiment API的schema.json文件转换为TypeScript声明文件

来自此:
schema.json

[
  {
    "namespace": "tabsExtra","functions": [
      {
        "name": "create","type": "function","description": "tabs.create extra API.","async": true,"parameters": [
                    {
                        "name": "createProperties","type": "object","optional": true,"properties": {
                            "url": { "type": "string" },"active": { "type": "boolean","optional": true }
            }
                    }
        ]
      },{
        "name": "update","description": "Update tab extra API.","parameters": [
                    {
                        "name": "url","type": "string"
                    }
                ]
      }
    ]
  }
]

对此:
global.d.ts

declare namespace browser.tabsExtra {
    function create({url: string,active: boolean}): Promise<void>;
    function update(url: string): Promise<void>;
}

我尝试使用json-schema-to-typescript软件包,但得到[k: string]: unkNown;。 看起来不是为了这个。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...