pyodide / pyodide/webtypy

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

Open
#13 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
23
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the type tests added in issue #12 and the WebIDL-based definitions discussed here. Investigate how the js.Object example is represented, then review the TypeScript definitions and possible TypeScript-to-mypy approach raised in the issue. Done means there is a decided, tested way to typecheck JavaScript builtins.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.