打字稿中的bootbox编译错误

时间:2013-05-25 22:17:32

标签: typescript bootbox

当我导入bootbox.d.ts(https://github.com/borisyankov/DefinitelyTyped/blob/master/bootbox/bootbox.d.ts)作为打字稿参考时,我收到以下错误:

提供的参数与调用目标的任何签名都不匹配:     输入'{label:string; }''类型'BootboxHandler'

缺少属性'class'

这是bootbox.d.ts文件中抛出错误的代码

interface BootboxHandler {
    label: string;
    class: string;
    callback: (result?: any) => void;
}

1 个答案:

答案 0 :(得分:0)

问题是属性未设置为可选。 bootbox.d.ts应该有问号。

interface BootboxHandler {
    label: string;
    class?: string;
    callback?: (result?: any) => void;
 }