pyodide / webtypy

Python type definitions for web APIs
Mozilla Public License 2.0
13 stars 3 forks source link

Constructor `New` should be `new` #9

Closed hoodmane closed 9 months ago

hoodmane commented 9 months ago

I get the following mypy error:

error: "type[AbortController]" has no attribute "new"  [attr-defined]
            self.abortcontroller = AbortController.new()

In webtypy's bindings I see:

class AbortController:
    def New(self) -> AbortController: ...
    signal: AbortSignal
    def abort(self, reason: Any | None = None): ...

Here New should be new.

hoodmane commented 9 months ago

Actually it seems that there is a second problem which is that new needs to be a @classmethod

simonegiacomelli commented 9 months ago

I just published version 0.1.7 on pypi. Let me know if something is amiss

hoodmane commented 9 months ago

Thanks for the quick fix @simonegiacomelli! I should switch Pyodide over to using webtypy, it will turn up a bunch more problems. I will open more issues with some things.