Repository navigation
AOT with type hints generated from typescript compiler #812
|
Would it be possible to achieve an efficient AOT compiler with type hints from typescript? |
Answered by
bnoordhuis
Jan 10, 2025
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. |
3 replies
Answer selected by
laishere
|
For AOT compilation with types you can try using Facebook's Static Hermes with |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.