我想在我的 typescript Nodejs 项目中有顶级的等待。
我的 tsconfig 过去看起来像这样:
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"lib": [
"dom",
"es6",
"es2017",
"esnext.asynciterable"
],
"skipLibCheck": true,
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
#### other stuff which I think is not relevant removed ####
Run Code Online (Sandbox Code Playgroud)
我现在把它切换到
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"lib": [
"dom",
"es6",
"es2017",
"esnext.asynciterable"
],
"skipLibCheck": true,
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
#### other stuff which I think is not relevant removed ####
Run Code Online (Sandbox Code Playgroud)
我还添加到"type": "module"了我的 package.json 中。事实上我现在有能力做顶级的等待 …
我正在使用VSCode和JavaScript ES6 模块。
如果我自动完成的进口这样import * as test from './test'
的.js文件的结尾./test被丢失,我必须添加它手动。
是否有自动添加扩展名的设置?
javascript import typescript visual-studio-code vscode-settings