Skip to content

Commit 8ffaf2c

Browse files
committed
ts_project_worker: default-initialize tsc outDir
Some time ago, the tsc_project macro changed behavior. Before, `out_dir` would always be set, whereas now it may be `None`. If `out_dir` is unset, this expression will result in an incorrect output directory being used: ``` host.optionsToExtend.outDir = `${host.optionsToExtend.outDir}/${SYNTHETIC_OUTDIR}`; ``` (Would result in `'undefined/__st_outdir__'`).
1 parent 419df90 commit 8ffaf2c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ts/private/ts_project_worker.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,13 @@ function createProgram(args, inputs, output, exit) {
704704
}
705705

706706
function applySyntheticOutPaths() {
707+
if (!host.optionsToExtend.outDir) {
708+
if (host.optionsToExtend.rootDir) {
709+
host.optionsToExtend.outDir = host.optionsToExtend.rootDir
710+
} else {
711+
host.optionsToExtend.outDir = '.'
712+
}
713+
}
707714
host.optionsToExtend.outDir = `${host.optionsToExtend.outDir}/${SYNTHETIC_OUTDIR}`;
708715
if (host.optionsToExtend.declarationDir) {
709716
host.optionsToExtend.declarationDir = `${host.optionsToExtend.declarationDir}/${SYNTHETIC_OUTDIR}`

0 commit comments

Comments
 (0)