如何安装自定义types?
我创build了一个自定义的input包含代码,我想分享几个webstorm node.js项目。 问题是,我正在试图find文件,概述如何在项目中包含input。 我尝试使用npm命令,但没有将该文件夹添加到/ node_modules文件夹下的@typings文件夹中。 此外,当我编译项目,我试图添加自定义打字,我在包含打字的项目和我想添加打字的项目之间的mongoose库重复错误。 我不确定问题可能是什么。
tsconfig.json(对于新types):
{ "name": "newcustomtype", "description": "...", "version": "1.0.0", "main": "./dist/index.js", "typings": "./dist/index.d.ts", "scripts": { "grunt": "grunt" }, "dependencies": { "@types/express": "^4.0.35", "@types/express-jwt": "0.0.34", "debug": "^2.2.0", "dotenv": "^4.0.0", "mongoose": "^4.9.2", "tslint": "^4.5.1" }, "devDependencies": { "@types/mongodb": "^2.1.41", "@types/mongoose": "^4.7.9", "@types/node": "^7.0.10", "grunt": "^1.0.1", "grunt-cli": "^1.2.0", "grunt-contrib-watch": "^1.0.0", "grunt-ts": "^6.0.0-beta.15", "grunt-tslint": "^4.0.1", "nodemon": "^1.11.0", "ts-node": "^3.0.2", "tslint": "^4.5.1", "typescript": "^2.2.1" } }
tsconfig.json(应该安装input的地方):
{ "compilerOptions": { "module": "commonjs", "target": "ES5", "moduleResolution": "node", "experimentalDecorators": true, "emitDecoratorMetadata": true, "types": ["reflect-metadata"], "lib": ["ES6"], "sourceMap": true, "inlineSources": true, "pretty": true, "outDir": "dist", "rootDir": "src", "noLib": false }, "include": [ "src/**/*.ts" ], "exclude": [ "node_modules" ], "compileOnSave": false }
我试图按照文档。 在打字稿网站上,但我一直无法find一个资源概述如何安装一旦创build。 虽然,为了不安装自定义input,我想我的tsconfig文件也有问题。 请检阅并让我知道我缺less什么?
提前致谢。
node_modules/@types
文件夹仅用于由npm安装的定义。 对于自定义types,最好在你的tsconfig.json
指定 tsconfig.json
。 例如:
{ [...] "compilerOptions": { [...] "typeRoots" : ["../path/to/typings", "./node_modules/@types"], [...] } [...] }
- 在使用Typescript的Aurelia中使用Jquery
- 找不到名称“控制台”。 这可能是什么原因?
- VS.代码中的Node.js TypeScriptdebugging
- 我怎样才能得到Visual Studio Typescript 1.7 intellisense与nodejs库(angular2,rxjs)?
- 使用index.ts导出“默认”
- 使用cxsd将.xsd转换为TypeScript,不能识别cxsd
- 导入到Node.js的TypeScript文件没有被名称空间部分声明识别的包?
- 如何configuration使用从PureScript编译的JavaScript模块的TypeScript项目?
- 节点与Chrome,实施instanceof,多个文件