使用.d.ts

时间:2019-01-19 11:05:05

标签: javascript typescript

我想使用一个JavaScript库,该库在我的打字稿项目中提供控件,但是在此lib的打字稿或.d.ts中没有定义。 有可能吗?

所以让我纠正一下,我想使用devexpress库仪表板查看器 https://documentation.devexpress.com/Dashboard/119108/Building-the-Designer-and-Viewer-Applications/Web-Dashboard/HTML-JavaScript-Dashboard-Control https://documentation.devexpress.com/Dashboard/119158/Building-the-Designer-and-Viewer-Applications/Web-Dashboard/HTML-JavaScript-Dashboard-Control/Client-Side-Configuration-Global-Namespaces

但是在devexpress组的typescript.d.ts中,没有计划使用此功能的控件

DevExpress.Dashboard.ResourceManager.embedBundledResources();
// Creates a new Web Dashboard control with the specified ID and settings:
var dashboardControl = new DevExpress.Dashboard.DashboardControl(document.getElementById("container"), {
    // Configures an URL where the Web Dashboard's server-side is hosted:
    endpoint: "https://demos.devexpress.com/services/dashboard/api",
    workingMode: "Viewer",
    extensions: {
        "dashboard-panel": (control) => new DevExpress.Dashboard.DashboardPanelExtension(control)
    }
});

我想在我的打字稿文件中使用它,因此即使将javascript加载到我的html文件中也无法识别它

提前, 拉兹格特

1 个答案:

答案 0 :(得分:0)

我通过运行命令npm i @types/knockout

对其进行了修复