AOT with type hints generated from typescript compiler #812
-
Would it be possible to achieve an efficient AOT compiler with type hints from typescript? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
How would quickjs see those type hints? It operates on JS, not TS. If you mean magic comments, that's basically what this stage 1 type annotations proposal proposes, but they're useless to a JS engine because at runtime they're descriptive, not prescriptive. A function that says it adds two numbers must still be able to handle strings as inputs. (Also, I don't think that proposal is going anywhere. It's been sitting at stage 1 for years.) The stage 2 structs proposal is more likely to go places and yield real improvements. |
Beta Was this translation helpful? Give feedback.
-
For AOT compilation with types you can try using Facebook's Static Hermes with |
Beta Was this translation helpful? Give feedback.
How would quickjs see those type hints? It operates on JS, not TS.
If you mean magic comments, that's basically what this stage 1 type annotations proposal proposes, but they're useless to a JS engine because at runtime they're descriptive, not prescriptive. A function that says it adds two numbers must still be able to handle strings as inputs.
(Also, I don't think that proposal is going anywhere. It's been sitting at stage 1 for years.)
The stage 2 structs proposal is more likely to go places and yield real improvements.