Closed
Description
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.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
NekR commentedon May 4, 2015
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.
mhegazy commentedon May 5, 2015
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.
rielz commentedon May 5, 2015
Extracting WebIDL from the spec is actually not a problem. The IDL parts are found in
<pre>
tags withidl
class.That is true for most of the specs at w3.org and whatwg.org, but some of them might contain non-standard IDL.
Example for DOM4: https://gist.github.com/rielz/af4d8e75b147c5f4bc69
Also WebGL: https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
mhegazy commentedon May 5, 2015
@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.
zhengbli commentedon May 5, 2015
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.
mhegazy commentedon Dec 9, 2015
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.
chicoxyzzy commentedon May 1, 2016
Does it generates definitions for whatwg spec? Looks like it generates definitions based on some Edge's IDL
chicoxyzzy commentedon May 1, 2016
also are these definition in
lib.dom.d.ts
now?chicoxyzzy commentedon May 1, 2016
and how to contribute to this file or should I contribute to Edge IDL or somewhere else?
because this should be valid https://www.typescriptlang.org/play/#src=new%20Text(%22test%22)%3B according to spec
kitsonk commentedon May 2, 2016
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.
chicoxyzzy commentedon May 2, 2016
It's still not clear how exactly definitions are generated. Can you explain this process a little bit?
kitsonk commentedon May 2, 2016
When the TypeScript team regularly generate the library files as part of the build process. The team use whatever the master version of
TSJS-lib-generator
that is available, so merged PRs there will effect the output of that tool, ergo, effect what is included with the next release of TypeScript.1 remaining item
kitsonk commentedon May 2, 2016
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:
Source: data.microsoftedge.com API Catalog
mhegazy commentedon May 2, 2016
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
--lib
flag, e.g.dom.chrome
,dom.edge
, etc..ShuiRuTian commentedon Jun 22, 2020
emmmm, is this issue fixed? It does fetch "https://dom.spec.whatwg.org/" form idlSource.json to generate d.ts now.
If not, what does it still need to do?
RyanCavanaugh commentedon Jun 22, 2020
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.