[英]How to install custom typings?
我創建了一個自定義類型包含我想在幾個webstorm node.js項目中共享的代碼。 問題是我試圖找到文檔,概述如何在項目中包含輸入。 我嘗試使用npm命令,但它沒有將文件夾添加到/ node_modules文件夾下的@typings文件夾中。 此外,當我編譯我試圖添加自定義類型的項目時,我在包含鍵入的項目和我想要添加鍵入的項目之間的mongoose庫中出現重復錯誤。 我不確定問題是什么。
tsconfig.json(對於新類型):
{
"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(應該安裝鍵入的地方):
{
"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
}
我試着按照文檔。 在打字稿網站上但我找不到資源概述如何安裝一旦創建。 雖然,為了不安裝自定義類型,我認為我的tsconfig文件也存在問題。 請檢討並告訴我我錯過了什么?
提前致謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.