I find it mind boggling you don't understand that the solution provided here is about type-checks on data, i.e. data validation.
And you can use TypeScript all day but not be protected from missing or wrong data validation. No compiler in the world can help you there.