Open jakobaxelsson opened 12 months ago
Maybe it would be possible to automatically generate the type information, to ensure that this is correct? It would be possible to use the typescript interface file for the DOM model as input. The package ts_interface_parser can be used to map this information into a json file, that could be used to generate a Python script with the typing.
Mypy reports some errors related to the results of the wrap function (which actually creates an instance of the wrap subclass of DomElement.
It would actually make more sense to make wrap a function instead. This would require that the init function of DOMElement is modified so that it can also create a DOMElement from an existing JSDomElement or JSDocument. The only place where this init function is currently called is in create_tag.
The JS protocols added for type checking are not entirely correct. In the DOM model, both Element and Document are subclasses of Node. So maybe that should be reflected to make the code more consistent?