diff --git a/merge-check-typescript.sh b/merge-check-typescript.sh index b6885c42..de5aa5a0 100644 --- a/merge-check-typescript.sh +++ b/merge-check-typescript.sh @@ -63,24 +63,27 @@ for m in $touched; do cp -r "$p" "$copy/node_modules/" done sources=$(cd "$copy" && find . -name '*.ts' ! -name '*.d.ts' ! -path './test/*' ! -path './node_modules/*' ! -path './dist/*' | sort) - if [ -z "$sources" ]; then - continue - fi - echo "type-checking $d (TypeScript)" - # shellcheck disable=SC2086 # the module's sources, none with a space in its name - if ! (cd "$copy" && node "$tsc" --noEmit --module NodeNext --moduleResolution NodeNext --target ES2022 \ - --types node $sources); then - failed="$failed $m" - continue + if [ -n "$sources" ]; then + echo "type-checking $d (TypeScript)" + # shellcheck disable=SC2086 # the module's sources, none with a space in its name + if ! (cd "$copy" && node "$tsc" --noEmit --module NodeNext --moduleResolution NodeNext --target ES2022 \ + --types node $sources); then + failed="$failed $m" + continue + fi + else + echo "$d has no TypeScript sources of its own to type-check: its tests read its files" fi if ! ls "$copy"/test/*.test.ts >/dev/null 2>&1; then echo "NOT TESTED: $d is TypeScript and has no tests of its own" continue fi - # shellcheck disable=SC2086 - (cd "$copy" && node "$tsc" --module NodeNext --moduleResolution NodeNext --target ES2022 --types node \ - --rootDir . --outDir dist $sources && node "$tsc" --module NodeNext --moduleResolution NodeNext \ - --target ES2022 --types node --rootDir . --outDir . $sources) + if [ -n "$sources" ]; then + # shellcheck disable=SC2086 + (cd "$copy" && node "$tsc" --module NodeNext --moduleResolution NodeNext --target ES2022 --types node \ + --rootDir . --outDir dist $sources && node "$tsc" --module NodeNext --moduleResolution NodeNext \ + --target ES2022 --types node --rootDir . --outDir . $sources) + fi echo "testing $d (TypeScript)" if ! (cd "$copy" && node --test --test-reporter=spec --experimental-strip-types \ --no-warnings=ExperimentalWarning test/*.test.ts); then