Jim*_*and 2 intellisense node.js typescript visual-studio-code
无法让智能感知为 .ts 文件工作。
测试.js
var http = require('http');
http.[intellisense available]
Run Code Online (Sandbox Code Playgroud)
测试文件
var http = require('http');
http.[no suggestions]
Run Code Online (Sandbox Code Playgroud)
似乎没有在阅读 index.d.ts
这是tsconfig.json:
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"watch": true
}
}
Run Code Online (Sandbox Code Playgroud)
有什么建议。真的很想使用打字稿,但在学习节点时需要提示。最好不要使用 javascript。
谢谢。
学习曲线。
对于 .js 文件:
var http = require('http');
Run Code Online (Sandbox Code Playgroud)
对于 .ts 文件:
import http = require('http');
Run Code Online (Sandbox Code Playgroud)
转译器会写出:var http = ...
“导入”而不是“var”使智能感知工作。右键单击“转到定义”有效。
问题解决了。
| 归档时间: |
|
| 查看次数: |
826 次 |
| 最近记录: |