我希望使用TypeScript作为一个“模块”来执行单个ts-node文件,以利用import type语法。使用.ts扩展时,我会得到警告Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs,然后是错误SyntaxError: Unexpected tok
我正在为TypeScript的一所大学做一个项目,并试图在使用Mocha运行测试的同时在vscode上进行调试。: SyntaxError: Cannotuseimportstatementoutside a module
at wrapSafe (internal/modules/cjs/loader.js:17:47 我尝试首先运行的测试名为q2-tests.test.ts,并具有以下导入: i