-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Generate lib.d.ts from w3c dom spec #3027
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
Comments
Is problem here what that webidl file tightly coupled to IE or problem is what scripts extracts data only from IE? Just want to understand if this issue requires script to be build or just dedicated webidl definition. If last, then probably easier way is to just grab it from blink/webkit/gecko sources and modify to not be vendor specific. |
the problem is that the webidl is from IE :D
I am not sure starting from different vendor-specific idl definition solves the problem, assuming that we are looking for the standard. What i need to research, is there is a .webidl file with the standard that we can run our script against, we need a new tool that can look at another format to generate the lib. |
Extracting WebIDL from the spec is actually not a problem. The IDL parts are found in Example for DOM4: https://gist.github.com/rielz/af4d8e75b147c5f4bc69 |
@zhengbli can you share your script to create a .d.ts. We can put it in a different repro so we can iterate on it, and allow others to help as well. |
Sure I'll do that soon. However the script is for parsing the XML spec files instead of the idl files we got from the IE team. |
lib.d.ts generation script is now open source under https://github.com/Microsoft/TSJS-lib-generator. PR's to generate a more standards-friendly version are welcomed. |
Does it generates definitions for whatwg spec? Looks like it generates definitions based on some Edge's IDL |
also are these definition in |
and how to contribute to this file or should I contribute to Edge IDL or somewhere else? |
The contribution guidelines are available in the project's README. Essentially you contribute by overriding whatever is auto-generated as laid out in the steps provided. Also opening an issue with the repository, if you don't feel comfortable submitting the PR, might get someone else to go ahead and make the change. |
It's still not clear how exactly definitions are generated. Can you explain this process a little bit? |
When the TypeScript team regularly generate the library files as part of the build process. The team use whatever the master version of |
What IDL is used as source? It seems like it is some Edge IDL not WHATWG IDL |
That is what this whole ticket is about. Currently the tool uses the Edge IDL, though @mhegazy suggested some other way would be better, but this issue being still open and the labels indicate that the TypeScript community is open to considering to moving to a different way, but in the priority of the backlog, they are leaving it open to the larger community to make the change if they do so. It is likely any change to the WHATWG IDL will cause some significant regressions in functionality of already existing code and therefore isn't a straight forward swap, visualised here: |
As i have noted earlier, the script that generates the library is available under r https://github.com/Microsoft/TSJS-lib-generator, and we would be happy to look at a PR that makes the generation more standards compliant. We will have to look at the differences of the resulting library file and the one we have now (created from Edge IDL + hand authored augmentations). and based on this decide how to surface that to the user, i.e. 1. as a single standard lib, 2. as flavored lib with |
emmmm, is this issue fixed? It does fetch "https://dom.spec.whatwg.org/" form idlSource.json to generate d.ts now. |
Yeah, this has basically been implemented at https://github.com/microsoft/TSJS-lib-generator . We use a slightly different IDL file but the differences are basically immaterial at this point. |
lib.d.ts should be created from http://www.w3.org/TR/dom/.
We already have a script that generates the lib from a webidl file.
The text was updated successfully, but these errors were encountered: