I'd like to incorporate a type check in my build process.
I keep my build process in a build.sh
file where a call multiple CLI like:
// TYPE CHECK HERE <---
rimraf dist
webpack...
babel...
I'd like to type check my /src
folder and stop my build process if it find any type errors.
How can I do that? Should I use tsc
? Is there any option I need to add to make it stop in case it finds any errors?
I'm trying implement this basic functionality example:
test.sh
tsc src/testScript.ts --noEmit --skipLibCheck
echo "AFTER TSC"
I've intentionally added this error to the testScript.ts
.
You can see that the rest of the test.sh
script just keeps running. Is there a way to check if the tsc
call has found any errors? Then I could check the result and stop the script at that point.