3 ms·
You can use a runtime type system like io-ts or something like reflect-metadata. Let's not pay the cost when we don't need it.
by mixedCase 4y ago
You can use a runtime type system like io-ts or something like reflect-metadata. Let's not pay the cost when we don't need it.
- jupp0r 4y agoThe compiler knows when this is used and can only insert type metadata when needed. io-ts and reflect-metadata are unwieldy crutches compared to a type system that's designed to influence runtime behavior (ie Rust, C++, etc).
- rektide 4y agohttps://github.com/tc39/proposal-decorator-metadata https://github.com/tc39/proposal-decorator-metadata is where we'd probably need to begin to store this information. It's still need a transpiler to generate the necessary decorators. Decorators are still in progress (but kind of seemingly shaping up these days).