|
|
|
|
|
by brap
426 days ago
|
|
Look at how it’s done in Python, with Pydantic for example. The runtime information allows you to write plain typed functions (for example in FastAPI), and you can be 100% confident these are the types your function will actually receive at runtime, without having to write the types in a separate DSL. This is not possible in standard TS. |
|
That doesn't work for JavaScript; you need full backwards compatibility at all times. Porting runtime type information to JS would change the language innards so much, it'd just be a different language in the end. At that point we could equally argue whether browser vendors should ship a Python runtime in browsers and add support for <script type="application/python">.