我使用的是ssh2-sftp-client
NPM包,它的类型是由@types/ssh2-sftp-client
提供的。我安装了这两个包,但没有选择任何类型。这是我的package.json
的外观:
{
"name": "name",
"version": "0.1.0",
"description": "description",
"devDependencies": {
"@types/ssh2": "^1.11.7",
"@types/ssh2-sftp-client": "^9.0.0"
},
"dependencies": {
"ssh2-sftp-client": "^9.0.4"
}
}
有一个related answer,但是它似乎处理了你自己声明的类型。在安装了任何@typings
包之后,我需要做进一步的设置吗?
编辑...我忘了添加tsconfig.json
文件:
"compilerOptions": {
"lib": ["ES2022"],
"module": "commonjs",
"target": "ES2022",
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"strictPropertyInitialization": false,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"node_modules/**/*",
"cdk.out"
]
}
1条答案
按热度按时间1tuwyuhd1#
正如@Yury Tarabanko所建议的那样,我重新启动了语言服务器,这就成功了。在VSCode上,按
Cmd/Ctrl + Shift + P
调出命令面板,然后搜索/运行Developer: Reload Window
。