TypeScript · Junior · Question 2 of 75

Does TypeScript check types while the program is running?

Explanation

TypeScript is a development-time tool. If an API returns null instead of an object, types won't save you. For runtime checks, use typeof/instanceof and schema libraries (Zod, Valibot), from which you can also infer TS types.

Further reading

Problem with a question

TypeScript · Junior · question 2

Test yourself

Take the TypeScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz