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.