Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题复现:在 window 下,ytt.config.js 中设置 target: 'javascript', 发觉没有生成 对应的文件 *.js 与 *d.ts,
排查过程:排查定位到是在 line 521 左右
if (syntheticalConfig.target === 'javascript') { await this.tsc(outputFilePath) await Promise.all([ fs.remove(requestFunctionFilePath).catch(noop), fs.remove(requestHookMakerFilePath).catch(noop), fs.remove(outputFilePath).catch(noop), ]) }
this.tsc() 执行不成功,没有将对应的 *.ts 通过 tsc 编译成 *.d.ts 与 *.js 。
原因:
linux 与 macos
都能直接执行require.resolve(
typescript/bin/tsc)
该可执行文件,而window
的可执行文件是*.cmd
故,this.tsc 在 window 执行失败
demo: https://github.com/yolo-jane/yapi2ts-bug-on-win