Fran Armijo Farmijo | Random thoughts blog

4/14/2022 ~ 1 min read

Typescript types are not really robust...

Actually, they mostly are, but there are flaws that will make you think (justifiably) that they're not


I had written a really long post about NestJS, types, layers and typescript, but I realized that what I wanted to express was really more simple.

Typescript is not a language, Typescript is a tool over plain JS that provides you extra functionality, basically, static type-checking. The moment you are in runtime, you’re running plain JS and you won’t have that safety net.

This means that:

- Any external data coming at runtime probably won’t be type-checked.

- Any modification of objects at runtime won’t be type-checked (eg, middlewares) and also will mess with the written code.

- Any validations based on types won’t be checked at runtime, since types disappear.

I’ll be adding samples to know when not trust typescript.


Headshot of Fran Armijo

Hi, I'm Fran. I'm a software engineer and musician based in Barcelona.