TypeScript actually only performs static type checking at compile-time. The idea is that if the scripts pass static type checking, then some level of type safety is guaranteed for inputs.
An important thing to note here is that, if you have the
noEmitOnError option set to
There are of course ways to achieve some level of type safety at runtime as well. For example, you could consider the following:
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.