0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/bin/check-typescript-strict
Michael Matloka 77621366de
Fix remaining TypeScript errors (#6436)
* Fix remaining TS errors and remove `.ts-strict-blacklist`

* Move `IGNORED_SPECS` to top
2021-10-14 15:08:42 +00:00

24 lines
728 B
Bash
Executable File

#!/bin/bash
echo "Refreshing Kea logic types and running the TypeScript compiler in dry mode..."
echo
IGNORED_SPECS=('Type.ts') # *Type.ts* files are ignored, as they are generally created by kea-typegen
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 ${IGNORED_SPECS})
NEW_ERRORS_COUNT="$(echo "${NEW_ERRORS}" | wc -l)"
if test -z "${NEW_ERRORS}"
then
echo "No TypeScript errors found in this PR! 🚀"
exit 0
else
echo "Found ${NEW_ERRORS_COUNT} TypeScript errors in this PR! 💥"
echo "${NEW_ERRORS}"
exit 1
fi