0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/bin/check-typescript-strict

24 lines
695 B
Plaintext
Raw Normal View History

#!/bin/bash
echo "Refreshing typegen and running 'tsc -p tsconfig.strict.json'..."
echo ""
yarn typegen:write &> /dev/null
ALL_ERRORS=$(yarn typescript:check --strict 2> /dev/null | grep error | grep frontend)
ERRORS_COUNT=$(echo "${ALL_ERRORS}" | wc -l)
NEW_ERRORS=$(echo "${ALL_ERRORS}" | grep --invert-match --fixed-strings --file=.ts-strict-blacklist)
NEW_ERRORS_COUNT="$(echo "${NEW_ERRORS}" | wc -l)"
echo "In total there are ${ERRORS_COUNT} typescript errors."
if test -z "${NEW_ERRORS}"
then
echo "No new typescript errors found in this PR! 🚀"
exit 0
else
echo "Found ${NEW_ERRORS_COUNT} new typescript errors in this PR! 💥"
echo "${NEW_ERRORS}"
exit 1
fi