typescript - 打字稿文件为空导致问题
问题描述
我试图删除该文件,但错误消息并没有消失。我解决问题的唯一方法是导出文件,然后导入我的 app.tsx 文件。
Failed to compile
/Users/steven/react-typescript-todolist/src/components/Todo.tsx
TypeScript error in /Users/steven/react-typescript-
todolist/src/components/Todo.tsx(undefined,undefined):
'Todo.tsx' cannot be compiled under '--isolatedModules' because it is considered a global
script file. Add an import, export, or an empty 'export {}' statement to make it a module.
TS1208
This error occurred during the build time and cannot be dismissed.
有人可以解释为什么会弹出这个错误以及为什么删除文件不能解决问题吗?
解决方案
推荐阅读
- python - 无法使用 GPU 来拟合使用 Keras 的模型
- tensorboard - 平滑曲线始终低于 Tensorboard 上的非平滑曲线
- python - 在 PySpark 中使用正则表达式创建 N-Gram
- swift - SwiftUI - 致命错误:从数组中删除元素时索引超出范围
- assembly - 为什么我不能在 Assembly 中声明一个采用取消引用变量的值的变量?
- ruby-on-rails - 使用 devise 和 omniauth-facebook 时,为什么 facebook 显示“提供的应用 ID 看起来不像有效的应用 ID。”?
- ffmpeg - Apple Automator、Shell 脚本和批处理文件 - 视频字幕
- perl - 如何以矩阵格式打印数组
- reactjs - webdriverIO v6:browser.getCurrentTabId() 和 browser.windowHandles() 不是版本 6 中的函数。替换是什么?
- node.js - nodejs 并对 socket.io 的不同端口做出反应?