Node.js 节点将url和querystring类型导入到TypeScript应用程序
我想在TypeScript应用程序中导入Node.js 节点将url和querystring类型导入到TypeScript应用程序,node.js,typescript,Node.js,Typescript,我想在TypeScript应用程序中导入url和querystring节点模块 import url from 'url'; import querystring from 'querystring'; 但是我得到了休整警告,我没有从中得到打字的机会 [ts]找不到模块“url”的声明文件/节点_modules/url/url.js’隐式具有“any”类型。 如果存在,请尝试npm install@types/url,或者添加包含声明模块“url”的新声明(.d.ts)文件[7016] 我知道
url
和querystring
节点模块
import url from 'url';
import querystring from 'querystring';
但是我得到了休整警告,我没有从中得到打字的机会
[ts]找不到模块“url”的声明文件/节点_modules/url/url.js’隐式具有“any”类型。
如果存在,请尝试npm install@types/url
,或者添加包含声明模块“url”的新声明(.d.ts)文件代码>[7016]
我知道url
和querystring
是节点模块。我已经安装了“@types/node”:“^10.12.9”,
,但它既不能解决键入问题,也不能解决警告问题
我应该怎么做才能从中获得打字信息?
信息:我是一个使用Vue CLI的前端应用程序
这是我的ts.config
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"strictNullChecks": false,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noImplicitAny": false,
"baseUrl": ".",
"types": ["webpack-env", "mocha", "chai"],
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
"exclude": ["node_modules"]
}
和package.json
{
"name": "rating-form",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"axios": "^0.18.0",
"bootstrap": "^4.1.3",
"jquery": "^3.3.1",
"moment": "^2.22.2",
"popper.js": "^1.14.4",
"toastr": "^2.1.4",
"vue": "^2.5.17",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vue-router": "^3.0.1",
"vue-slider-component": "^2.8.0"
},
"devDependencies": {
"@types/chai": "^4.1.0",
"@types/mocha": "^5.2.4",
"@types/node": "^10.12.9",
"@types/qs": "^6.5.1",
"@types/toastr": "^2.1.35",
"@vue/cli-plugin-typescript": "^3.1.1",
"@vue/cli-plugin-unit-mocha": "^3.1.1",
"@vue/cli-service": "^3.1.1",
"@vue/test-utils": "^1.0.0-beta.20",
"chai": "^4.1.2",
"ts-node": "^7.0.1",
"typescript": "^3.1.6",
"vue-template-compiler": "^2.5.17"
}
}
在尝试导入之前,是否包含引用节点
类型的三斜杠指令?例如,/
。