Javascript Typescript:如何在node_模块中导入和添加嵌套文件的类型?

Javascript Typescript:如何在node_模块中导入和添加嵌套文件的类型?,javascript,typescript,Javascript,Typescript,安装有: npm install highcharts typings install highcharts/highstock --ambient index.ts: import * as Highstock from 'highcharts/highstock' new Highstock() // Cannot use 'new' with an expression whose type lacks a call or construct signature. tsconfig.j

安装有:

npm install highcharts
typings install highcharts/highstock --ambient
index.ts:

import * as Highstock from 'highcharts/highstock'
new Highstock() // Cannot use 'new' with an expression whose type lacks a call or construct signature.
tsconfig.json:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "noEmitHelpers": true,
    "outFile": "./dist/index.js",
    "preserveConstEnums": true,
    "target": "es6"
  },
  "files": [
    "typings/browser.d.ts",
    "ty.d.ts",
    "src/index.ts"
  ]
}
new Highstock()//不能将“new”与类型缺少调用或构造签名的表达式一起使用


JavaScript库的TypeScript定义是最好的(即可能不是最新的)。该定义文件()不支持这种用法。如果这是一个应该被支持的用法,请随意为将来发现此问题的任何人创建Github Pull请求,我需要像这样包装highcharts打字:

declare module 'highcharts/highstock' {
  // typings go here
}

我假设有某种方法可以从这个声明的模块内部重新导出社区类型,但现在我正在手动添加类型。

构建定义的正确方法是什么?我尝试了以下方法,但没有任何区别: