Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade espower-typescript to 9.0 (#106)
<!-- Thank you for your pull request. Please review below requirements. Bug fixes and new features should include tests and possibly benchmarks. Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md 感谢您贡献代码。请确认下列 checklist 的完成情况。 Bug 修复和新功能必须包含测试,必要时请附上性能测试。 Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md --> ##### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [x] `npm test` passes - [ ] tests and/or benchmarks are included - [ ] documentation is changed or added - [x] commit message follows commit guidelines ##### Affected core subsystem(s) <!-- Provide affected core subsystem(s). --> ##### Description of change ### 修复两个问题 1. 将 espower-typescript 升级到 9.0.0 版本,由于老版本的 espower-typescript 自己进行了 ts 解析而没进行类型检查 ,所以会导致此前跑单测,对代码是不会做类型检查的。而 espower-typescript 9.0 版本改成使用 ts-node 进行解析,所以可以开启类型检查。 2. 之前 4.8.0 版本将 espower-typescript 升级到了 9.0.0 版本,但是由于 espower-typescript 中会 register 一下 ts-node,而本身 egg-bin 也会 register 一下 ts-node,从而导致触发了两次 register,就会导致 ts 被编译成 js 后又会再一次去被编译一次。从而导致爆出类型错误,所以在 4.8.0 的 PR 中又将 espower-typescript 改回了 8.0 版本。该 PR 在升级 espower-typescript 的同时也修复了该问题,因为这个多编译一次的问题是会在当前单测中稳定复现的,所以不需要新增单测。 ### 其他修改 由于 ts-node 可能是由 espower-typescript 引入,也可能是由 egg-bin 引入,所以删除 ts-helper.js( 此前是用来给 ts-node 传相关参数 ),改成使用环境变量来控制 ts-node 的入参,才能保证 espower-typescript 及 egg-bin 的表现一致。
- Loading branch information