3 ms·
Types are pretend in TypeScript and Flow the same way that types are pretend in any other typed language. Types are used at compile-time and not runtime in both
by rubiquity 10y ago
Types are pretend in TypeScript and Flow the same way that types are pretend in any other typed language. Types are used at compile-time and not runtime in both cases.
- egeozcan 10y agoIn contrast to many typed languages, currently in Typescript, you can't do any kind of reflection so runtime really has no access to the type system. Well, I still love TS though.
- johnfn 10y agoThere is the possibility of decorators for stuff like this. Angular makes a lot of use of them.
- tomelders 10y agoAre they used at compile time with TS or Flow? I thought they were just stripped out.
- wtetzner 10y agoWell, I assume they're at least used at type-checking time, which most people consider to be a subset of compile time.
- recursive 10y agoIn most other languages, type casts are assertions that can fail. Not typescript.