bb50fc131b
Also fixup the typings which were broken by changes in typescript's lib.d.ts. Second attempt to merge this, now that bugfix for tsd is in.