6
我創建了一個包含代碼的自定義類型,我想在幾個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文件也有問題。請檢閱並讓我知道我錯過了什麼?
在此先感謝。