Created
August 30, 2023 20:56
-
-
Save rphlmr/405209fbe96635e05033680af61ed9e6 to your computer and use it in GitHub Desktop.
Keep skipLibCheck to false and still typecheck your project's .d.ts files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RED="\e[31m" | |
ENDCOLOR="\e[0m" | |
echo "⏳ Checking for type errors..." | |
# Run tsc and capture the output | |
TYPE_ERRORS=$(tsc --project ./tsconfig.json 2>&1) | |
# Clean node_modules related errors because we use skipLibCheck:false | |
CLEAN_ERRORS=$(echo "$TYPE_ERRORS" | sed -e '/node_modules/,/node_modules/ d') | |
# Print the cleaned output | |
if [[ -n $CLEAN_ERRORS ]]; then | |
printf "${RED}❌ Type errors were found${ENDCOLOR}\n" | |
echo "$CLEAN_ERRORS" | |
exit 1 | |
fi | |
echo "✅ No type errors found" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In your package.json, add this script: