[mini] Extract type checking code into type-checking.c