问题描述
我想将自己的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 (将#修改为@)