Remix.run Logo
ninetyninenine 5 days ago

Can't be too hard imo. Primitives can contain an extra metadata field for the types defined in the code. This doesn't really interfere with the runtime and will be backwards compatible. The runtime of course still doesn't actually have to do any type checking, it's just forwarding the type information on a new metadata field so it's not in any way interrupting the core flow of the runtime logic. As a result you can still have the wrong type tagged onto a primitive just like TS has it currently.

Only downside I see is that It can slow down the code as the runtime now has to evaluate type level functions in order to know what to place in the metadata.

But you're right in the sense that it has to go into the core ECMA specification rather then being a node project.

pinoy420 5 days ago | parent [-]

[dead]