Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebIDL only describes web spec, what to do about JS builtins? #13

Open
hoodmane opened this issue Nov 22, 2023 · 1 comment
Open

WebIDL only describes web spec, what to do about JS builtins? #13

hoodmane opened this issue Nov 22, 2023 · 1 comment

Comments

@hoodmane
Copy link
Member

In #12 I added some type tests. The biggest issue that they seem to reveal is that we don't see JS builtins. For example, suppose someone uses Object:

from js import Object

Object.fromEntries([("a", 1), ("b", 2)])

This sort of code is pretty common in practice and ideally we'd want to be able to typecheck this. Since it's not in the webidl we'd need to get the info from some other source. Unfortunately that seems like a lot of work...

Some thoughts:

  1. Maybe there are typescript type definitions that we can use?
  2. But then maybe those also cover everything in the webidl?
  3. So maybe what is actually needed is a tool for converting from typescript to mypy?
@hoodmane
Copy link
Member Author

hoodmane commented Dec 4, 2023

Okay I made the following to convert from the typescript declarations for the JS builtins to mypy:
https://github.com/hoodmane/ts-to-python

But then maybe those also cover everything in the webidl?

The biggest annoyance I've found compared to webidl is that webidl distinguishes between integer and floating point types but typescript doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant