TypeScript 4.4 libdom changes
See original GitHub issueBeta
With TypeScript 4.4, we coordinated some pretty fundamental infrastructure work to prepare for the version of dom.d.ts with the future of the generator repo. This work resulted in two note-worthy items:
-
The
dom.d.tsfiles typically accessed inside TypeScript are now also deployed to@types/webstarting with version0.0.1which corresponds to the version oflibdom.d.tsin TypeScript 4.3. This means an update to TypeScript 4.4 does not mean you have to update all of your web.d.tsfiles.The name change is to more accurately reflect the scope of the APIs, for a long time the file has provided much more APIs than just the DOM and
@types/webreflects that. If you’re interested in switching to use@types/web, there are instructions in the npm README. -
The 4.4
dom.d.tsfile which is included with TypeScript includes quite a lot of changes, with a lot of APIs which have been marked as deleted by the web standards committees. You can see the full list in this issueWe’ve been testing these changes with DefinitelyTyped, and have been individually rolling back changes which we think are a bit too breaking, this is more of an art than a science however. If you think we should rollback a particular change we’re open to discussing change in this issue or the
dom-lib-generatorchannel in the TypeScript Community Discord
We plan to have thorough support for replacing lib.dom.d.ts with @types/web in 4.5 with https://github.com/microsoft/TypeScript/issues/44795
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:69 (24 by maintainers)

Top Related StackOverflow Question
High Level Changes from 4.3 to 4.4
dom.d.tsNew interfaces
BlobEventCSSAnimationCSSCounterStyleRuleCSSTransitionClipboardItemFileSystemFileSystemDirectoryEntryFileSystemDirectoryReaderFileSystemEntryFileSystemFileEntryFontFaceFontFaceSetFontFaceSetLoadEventFormDataEventIdleDeadlineMathMLElementMediaCapabilitiesMediaMetadataMediaRecorderMediaRecorderErrorEventMediaSessionNetworkInformationPerformanceEventTimingPerformancePaintTimingPictureInPictureWindowRemotePlaybackSVGMPathElementSVGSetElementSubmitEventRemoved interfaces
ApplicationCacheBhxBrowserCaretPositionClientRectClientRectListCryptoKeyPairDOMErrorDOMSettableTokenListDataCueDeferredPermissionRequestDeviceAccelerationDeviceRotationRateExtensionScriptApisFocusNavigationEventGamepadPoseHTMLAppletElementHTMLDialogElementHTMLTableDataCellElementHTMLTableHeaderCellElementInputDeviceInfoListeningStateChangedEventMSAssertionMSBlobBuilderMSFIDOCredentialAssertionMSFIDOSignatureMSFIDOSignatureAssertionMSGestureMSGraphicsTrustMSInputMethodContextMSMediaKeyErrorMSMediaKeySessionMSMediaKeysMSStreamMediaStreamErrorMediaStreamErrorEventMediaStreamEventMediaStreamTrackAudioSourceNodeNavigationPreloadManagerNodeFilterOffscreenCanvasOffscreenCanvasRenderingContext2DOverflowEventPerfWidgetExternalPermissionRequestPermissionRequestedEventRTCDtlsTransportStateChangedEventRTCDtmfSenderRTCErrorRTCErrorEventRTCIceCandidatePairChangedEventRTCIceGathererRTCIceGathererEventRTCIceTransportStateChangedEventRTCIdentityAssertionRTCSctpTransportRTCSrtpSdesTransportRTCSsrcConflictEventRTCStatsProviderRandomSourceSVGCursorElementSVGElementInstanceSVGElementInstanceListSVGPathSegSVGPathSegArcAbsSVGPathSegArcRelSVGPathSegClosePathSVGPathSegCurvetoCubicAbsSVGPathSegCurvetoCubicRelSVGPathSegCurvetoCubicSmoothAbsSVGPathSegCurvetoCubicSmoothRelSVGPathSegCurvetoQuadraticAbsSVGPathSegCurvetoQuadraticRelSVGPathSegCurvetoQuadraticSmoothAbsSVGPathSegCurvetoQuadraticSmoothRelSVGPathSegLinetoAbsSVGPathSegLinetoHorizontalAbsSVGPathSegLinetoHorizontalRelSVGPathSegLinetoRelSVGPathSegLinetoVerticalAbsSVGPathSegLinetoVerticalRelSVGPathSegListSVGPathSegMovetoAbsSVGPathSegMovetoRelSVGZoomEventServiceUIFrameContextSpeechGrammarSpeechGrammarListSpeechRecognitionSpeechRecognitionErrorEventSpeechRecognitionEventStyleMediaSyncManagerTextEventVRDisplayVRDisplayCapabilitiesVRDisplayEventVREyeParametersVRFieldOfViewVRFrameDataVRPoseWebKitPointwebkitRTCPeerConnectionModified
onremove,replaceState,commitStyles,persistoutputLatency,createMediaStreamTrackSourceappearance,aspectRatio,backgroundBlendMode,borderBlock,borderBlockColor,borderBlockStyle,borderBlockWidth,borderEndEndRadius,borderEndStartRadius,borderInline,borderInlineColor,borderInlineStyle,borderInlineWidth,borderStartEndRadius,borderStartStartRadius,colorScheme,contain,counterSet,fontOpticalSizing,fontVariantAlternates,fontVariationSettings,inset,insetBlock,insetBlockEnd,insetBlockStart,insetInline,insetInlineEnd,insetInlineStart,isolation,marginBlock,marginInline,mixBlendMode,offset,offsetAnchor,offsetDistance,offsetPath,offsetRotate,paddingBlock,paddingInline,scrollMargin,scrollMarginBlock,scrollMarginBlockEnd,scrollMarginBlockStart,scrollMarginBottom,scrollMarginInline,scrollMarginInlineEnd,scrollMarginInlineStart,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollPadding,scrollPaddingBlock,scrollPaddingBlockEnd,scrollPaddingBlockStart,scrollPaddingBottom,scrollPaddingInline,scrollPaddingInlineEnd,scrollPaddingInlineStart,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollSnapAlign,scrollSnapStop,scrollSnapType,shapeImageThreshold,shapeMargin,shapeOutside,textDecorationSkipInk,textDecorationThickness,textUnderlineOffsetglyphOrientationVertical,maskComposite,maskImage,maskPosition,maskRepeat,maskSize,rubyAlign,textJustify,webkitTapHighlightColor,webkitTextSizeAdjust,zoomgetContextAttributesread,writeinitCompositionEventitempictureInPictureEnabled,rootElement,exitPictureInPicture,hasStorageAccess,requestStorageAccesscaretPositionFromPoint,getAnimationspartmsGetRegionContentwebkitRelativePathhand,posepulsecaptureStreamtransferControlToOffscreenouterTextrequestSubmitallowPaymentRequestcapture,webkitEntries,webkitdirectoryonbounce,onfinish,onstartdisableRemotePlayback,remoteformdisablePictureInPicture,onenterpictureinpicture,onleavepictureinpicture,requestPictureInPicturerequestdatabasescommitdataTransfer,getTargetRangesinitKeyboardEventcharpseudoElementgetDisplayMediacontentHintinitMessageEventmediaCapabilities,mediaSessionactiveVRDisplays,msManipulationViewsEnabled,msMaxTouchPoints,msPointerEnabled,getUserMedia,getVRDisplays,msLaunchUri,msSaveBlob,msSaveOrOpenBlobnamespaceURIactions,badge,image,renotify,requireInteraction,silent,timestamp,vibrateonshippingaddresschange,onshippingoptionchange,shippingAddress,shippingOption,shippingTypeonpayerdetailchange,payerEmail,payerName,payerPhone,shippingAddress,shippingOption,addEventListener,removeEventListenerdetaildetailexpirationTimeuserVisibleOnlyiceTransport,onerror,getRemoteCertificatesaddressongatheringstatechange,onselectedcandidatepairchange,onstatechange,role,getLocalCandidates,getLocalParameters,getRemoteCandidates,getRemoteParameters,getSelectedCandidatePair,addEventListener,removeEventListeneridpErrorInfo,idpLoginUrl,peerIdentity,sctp,getIdentityAssertion,setIdentityProvidersetCodecPreferencesforEachisHistoryNavigation,isReloadNavigationtrailerrel,relListbeginElement,beginElementAt,endElement,endElementAtpathSegList,getPointAtLength,getTotalLengthonunload,onzoom,getComputedStylelengthviewTargetdisposition,samplenavigationPreload,syncdelegatesFocuschangeTypeinitStorageEventfontBoundingBoxAscent,fontBoundingBoxDescentaltitudeAngle,azimuthAngle,touchTypeinitUIEventcorruptedVideoFramescancelIdleCallback,requestIdleCallbackapplicationCache,defaultStatus,doNotTrack,msContentScript,offscreenBuffering,oncompassneedscalibration,ondeviceorientationabsolute,ongamepadconnected,ongamepaddisconnected,onmousewheel,onreadystatechange,onvrdisplayactivate,onvrdisplayblur,onvrdisplayconnect,onvrdisplaydeactivate,onvrdisplaydisconnect,onvrdisplaypresentchange,styleMedia,departFocus,getMatchedCSSRules,msWriteProfilerMark,webkitCancelAnimationFrame,webkitConvertPointFromNodeToPage,webkitConvertPointFromPageToNode,webkitRequestAnimationFramecloseNon-value types
signalcolorSpace,willReadFrequentlystartTimeplaybackRatedataTransfer,targetRangespseudoElementencryptionSchemepreferCurrentTabcursor,displaySurface,logicalSurfacesuppressLocalAudioPlaybackautoGainControl,noiseSuppression,resizeModerestrictOwnAudioautoGainControl,channelCount,latency,noiseSuppression,resizeModesuppressLocalAudioPlaybackautoGainControl,channelCount,latency,noiseSuppression,resizeModeplaybackRateshippingOptionserror,payerErrors,shippingAddressErrorspayer,shippingAddressbytesDiscardedOnSend,circuitBreakerTriggerCount,consentExpiredTimestamp,consentRequestsSent,currentRtt,firstRequestTimestamp,lastPacketReceivedTimestamp,lastPacketSentTimestamp,lastRequestTimestamp,lastResponseTimestamp,packetsDiscardedOnSend,packetsReceived,packetsSent,priority,retransmissionsReceived,retransmissionsSent,totalRtterrorTextstatusTextprioritydegradationPreferencevoiceActivityFlagiceRole,packetsReceived,packetsSent,selectedCandidatePairChanges,tlsGroupdisposition,sampleslotAssignmentfileswhich"remove"scrollPathIntoViewpictureInPictureElement,getAnimationscaretPositionFromPoint,caretRangeFromPoint,elementFromPoint,elementsFromPoint,getSelection"formdata","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend""cancel","dragexit"onformdata,onwebkitanimationend,onwebkitanimationiteration,onwebkitanimationstart,onwebkittransitionendoncancel,ondragexit,onsecuritypolicyviolationunregisterProtocolHandlerreplaceChildren"shippingaddresschange","shippingoptionchange""error""SVGUnload","SVGZoom""abort","afterprint","beforeprint","beforeunload","blur","canplay","canplaythrough","change","click","compassneedscalibration","contextmenu","dblclick","deviceorientationabsolute","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","hashchange","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","message","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","offline","online","pagehide","pageshow","pause","play","playing","popstate","progress","ratechange","readystatechange","reset","resize","scroll","seeked","seeking","select","stalled","storage","submit","suspend","timeupdate","unload","volumechange","vrdisplayactivate","vrdisplayblur","vrdisplayconnect","vrdisplaydeactivate","vrdisplaydisconnect","vrdisplaypresentchange","waiting""gamepadconnected","gamepaddisconnected"ongamepadconnected,ongamepaddisconnectedcrossOriginIsolatedmemory,exception"applet""animate","animateMotion","animateTransform","feDropShadow","mpath","set"index.iterable.d.tsNon-value types
vibrateI tried upgrading from TS 4.3.5 to 4.4.2 today and encountered two issues:
HTMLDialogElementwent missing (as a value, not as a type). This is noted in the list above. But why? It’s supported by Chrome, Edge, and Opera, and by Firefox behind a flag. The type is still present, as it is needed to represent<dialog>elements. I can writedeclare var HTMLDialogElement: HTMLDialogElement;to allow using it as a value, but thenelement instanceof HTMLDialogElementno longer works as a type guard.HTMLInputElement.autofocuswas removed. This is not noted in the list above. This seems like a bug since it is supported in every browser. The MDN page’s browser compatibility section just refers to the page for the global autofocus attribute where it is noted as fully supported in Chrome, Edge, and Opera, and supported everywhere on several elements including HTMLInputElement. In my case, I have a custom JSX implementation, and I basically have to patch theHTMLInputElementtype to work around this.It would be great if these changes could be reverted.