Open jods4 opened 6 years ago
We have been more open in taking in these declarations into lib.d.ts. so feel free to send us a PR adding the new interfaces. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.
My understanding is that the basis used to generated DOM lib is the MS Edge definitions. Since those features have shipped (see https://twitter.com/MSEdgeUpdates/status/1000421335229784064 ) can we expect to see them in the next TS release? I hoped they would be in 2.9, too bad they're not :(
We are moving to generate the lib from the spec directelly. See https://github.com/Microsoft/TSJS-lib-generator/tree/master/inputfiles/idl
👍 that would fix it as well!
I noticed TypeScript v3.1 introduced a lot of new DOM functionality, including (among the most common):
ChildNode#after()
ChildNode#before()
ChildNode#replaceWith()
ParentNode#append()
ParentNode#prepend()
The release notes indicate that part of lib.d.ts
is now generated programmatically from the WHATWG DOM Spec. 🎊
This is basically a re-opening of #2910, which @mhegazy asked me to do.
Nowadays TS has the
lib
compiler option that allow users to selectively choose which core definitions to include or not based on their target.It would be nice to add a new option similar to
dom
anddom.iterable
for users targetting a modern DOM runtime. Not sure how to name this since W3C has moved from releases to a "living standard" model.For example, the living standard includes interfaces
ChildNode
with methodsafter
,before
,remove
andreplaceWith
;ParentNode
with methodsprepend
andappend
.Those methods have been in Firefox and Chrome for a long while, they're in preview in Edge (17035+).
They are very convenient and there's no reason a dev that targets modern browsers shouldn't be able to do
"lib": "dom.living"
and use them.Unfortunately I am not sure if there's a list somewhere of all those new features... except going through the whole standard :(