typescript - ts-node 抛出无关的奇怪错误,但使用 tsc 时没有抛出错误
问题描述
当我运行 ts-node 时,它会抛出这些错误
src/api/role.ts:2:58 - error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
2 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
~~~~~~~~~~~~~
src/api/role.ts:9:64 - error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?
9 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
但是在我的代码中找不到错误中提到的所有行。我尝试运行 tsc,它没有显示这些错误。所有这些错误仅在我使用 ts-node 时发生。
解决方案
我更改了我_moduleAliases
的 package.json 以引用构建的脚本。它可以工作,但是对于我的脚本中的每一个更改,我都需要运行tsc
.
推荐阅读
- docusignapi - Docusign - 无法使用 Users::list API 获取用户 GUIID
- java - 在 twilio 可编程聊天中转发消息
- javascript - Firestore按顺序将数据添加到Doc
- amazon-web-services - AWS CodeBuild - BuildSpec.yml - 导出的变量不解析值
- mysql - 在 phpMyadmin 设计器视图中创建 userID 和 userPosts 之间的关系
- android - ListViewItem 灰显
- graph - Graph API 是否支持自定义标头用作搜索过滤器?
- quill - 如何将属性添加到 Delta 对象中记录的列表项?
- python - 在 Google colab 上使用 pip3 安装的 python 包的位置
- r - 从R中的日期变量创建因子变量