Javascript 如何将函数参数声明为;QUnit“;用qunit键入TypeScript?

Javascript 如何将函数参数声明为;QUnit“;用qunit键入TypeScript?,javascript,typescript,qunit,Javascript,Typescript,Qunit,我在麻省理工学院使用许可证 用打字机脚本部分编写的项目。我有一些TS函数 接受QUnit作为参数,并希望将其键入其接口 从 例如: 从“QUnit”导入{QUnit}; 导出函数运行测试(q:QUnit) { q、 模块((a)=>{…}); } 但是,当我尝试时,我会遇到以下错误: tsc --project lib/typescript/www/tsconfig.json src/ts/web-fc-solve-tests.ts(12,23): error TS2306: File '/h

我在麻省理工学院使用许可证 用打字机脚本部分编写的项目。我有一些TS函数 接受QUnit作为参数,并希望将其键入其接口 从

例如:

从“QUnit”导入{QUnit};
导出函数运行测试(q:QUnit)
{
q、 模块((a)=>{…});
}
但是,当我尝试时,我会遇到以下错误:

tsc --project lib/typescript/www/tsconfig.json
src/ts/web-fc-solve-tests.ts(12,23): error TS2306: File '/home/shlomif/progs/fre
ecell/git/fc-solve/fc-solve/site/wml/node_modules/@types/qunit/index.d.ts' is no
t a module.
这是我的代码(注意分支):-它位于
fc solve/site/wml
子目录下

我的
tsconfig.json
是:

{
  "compilerOptions": {
      "baseUrl": ".",
      "esModuleInterop": true,
      "module": "amd",
      "moduleResolution": "node",
      "noImplicitReturns": true,
      "outDir": "../../../lib/out-babel/js",
      "paths": {
          "big-integer": ["node_modules/big-integer/BigInteger.d.ts"],
          "qunit": ["node_modules/@types/qunit"]
      },
      "target":"es6"
  },
  "include": ["../../../src/ts/**/*.ts"]
}

谢谢您的帮助。

如果您只需要打字,那么只需使用npm安装@types lib for qunit,而不必使用import语句

请提供更多细节。也许什么是类型定义,也许是指向实际库的链接。我也不认为你可以省略进口声明。谢谢!这确实起到了作用,我可以毫不费力地完成函数myfunc(qunit:qunit)。请参阅。欢迎来到堆栈溢出!这个
index.d.ts
来自哪里?您安装了库的类型了吗:
npm i-D@types/qunit
?@NitzanTomer:我用npm安装了它。