TypeScript转译后JavaScript文件为空且无报错,求解决方案
TypeScript转译后生成空JS文件的问题求助
我是TypeScript和JavaScript新手,昨天尝试将TypeScript(.ts)文件转译为JavaScript(.js)文件,全程无报错,但生成的JS文件为空。有没有人遇到过类似问题或有解决思路?
文件截图
- VS Code中的ts文件:

- 生成的js文件:

开发工具版本
theresa@xuans-air test % nvm --version 0.35.0 theresa@xuans-air test % npm -version 7.24.0 theresa@xuans-air test % node --version v16.10.0 theresa@xuans-air test % tsc --version Version 4.8.4 theresa@xuans-air ~ % code --help Visual Studio Code 1.73.0
设备与系统信息
- macOS
- MacBook Air (M1, 2020)
- 芯片:Apple M1
.zshrc文件配置
Homebrew部分
export PATH=/opt/homebrew/bin:$PATH export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh
NVM部分
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
已尝试的解决操作
- 重装所有开发工具
- 移除.zshrc文件中的NVM相关配置
以上操作后问题仍未解决。
内容的提问来源于stack exchange,提问作者TheCuriousCat
相关产品推荐
相关产品推荐

