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.ts
files typically accessed inside TypeScript are now also deployed to@types/web
starting with version0.0.1
which corresponds to the version oflibdom.d.ts
in TypeScript 4.3. This means an update to TypeScript 4.4 does not mean you have to update all of your web.d.ts
files.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/web
reflects that. If you’re interested in switching to use@types/web
, there are instructions in the npm README. -
The 4.4
dom.d.ts
file 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-generator
channel 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 GitHub Comments
High Level Changes from 4.3 to 4.4
dom.d.ts
New interfaces
BlobEvent
CSSAnimation
CSSCounterStyleRule
CSSTransition
ClipboardItem
FileSystem
FileSystemDirectoryEntry
FileSystemDirectoryReader
FileSystemEntry
FileSystemFileEntry
FontFace
FontFaceSet
FontFaceSetLoadEvent
FormDataEvent
IdleDeadline
MathMLElement
MediaCapabilities
MediaMetadata
MediaRecorder
MediaRecorderErrorEvent
MediaSession
NetworkInformation
PerformanceEventTiming
PerformancePaintTiming
PictureInPictureWindow
RemotePlayback
SVGMPathElement
SVGSetElement
SubmitEvent
Removed interfaces
ApplicationCache
BhxBrowser
CaretPosition
ClientRect
ClientRectList
CryptoKeyPair
DOMError
DOMSettableTokenList
DataCue
DeferredPermissionRequest
DeviceAcceleration
DeviceRotationRate
ExtensionScriptApis
FocusNavigationEvent
GamepadPose
HTMLAppletElement
HTMLDialogElement
HTMLTableDataCellElement
HTMLTableHeaderCellElement
InputDeviceInfo
ListeningStateChangedEvent
MSAssertion
MSBlobBuilder
MSFIDOCredentialAssertion
MSFIDOSignature
MSFIDOSignatureAssertion
MSGesture
MSGraphicsTrust
MSInputMethodContext
MSMediaKeyError
MSMediaKeySession
MSMediaKeys
MSStream
MediaStreamError
MediaStreamErrorEvent
MediaStreamEvent
MediaStreamTrackAudioSourceNode
NavigationPreloadManager
NodeFilter
OffscreenCanvas
OffscreenCanvasRenderingContext2D
OverflowEvent
PerfWidgetExternal
PermissionRequest
PermissionRequestedEvent
RTCDtlsTransportStateChangedEvent
RTCDtmfSender
RTCError
RTCErrorEvent
RTCIceCandidatePairChangedEvent
RTCIceGatherer
RTCIceGathererEvent
RTCIceTransportStateChangedEvent
RTCIdentityAssertion
RTCSctpTransport
RTCSrtpSdesTransport
RTCSsrcConflictEvent
RTCStatsProvider
RandomSource
SVGCursorElement
SVGElementInstance
SVGElementInstanceList
SVGPathSeg
SVGPathSegArcAbs
SVGPathSegArcRel
SVGPathSegClosePath
SVGPathSegCurvetoCubicAbs
SVGPathSegCurvetoCubicRel
SVGPathSegCurvetoCubicSmoothAbs
SVGPathSegCurvetoCubicSmoothRel
SVGPathSegCurvetoQuadraticAbs
SVGPathSegCurvetoQuadraticRel
SVGPathSegCurvetoQuadraticSmoothAbs
SVGPathSegCurvetoQuadraticSmoothRel
SVGPathSegLinetoAbs
SVGPathSegLinetoHorizontalAbs
SVGPathSegLinetoHorizontalRel
SVGPathSegLinetoRel
SVGPathSegLinetoVerticalAbs
SVGPathSegLinetoVerticalRel
SVGPathSegList
SVGPathSegMovetoAbs
SVGPathSegMovetoRel
SVGZoomEvent
ServiceUIFrameContext
SpeechGrammar
SpeechGrammarList
SpeechRecognition
SpeechRecognitionErrorEvent
SpeechRecognitionEvent
StyleMedia
SyncManager
TextEvent
VRDisplay
VRDisplayCapabilities
VRDisplayEvent
VREyeParameters
VRFieldOfView
VRFrameData
VRPose
WebKitPoint
webkitRTCPeerConnection
Modified
onremove
,replaceState
,commitStyles
,persist
outputLatency
,createMediaStreamTrackSource
appearance
,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
,textUnderlineOffset
glyphOrientationVertical
,maskComposite
,maskImage
,maskPosition
,maskRepeat
,maskSize
,rubyAlign
,textJustify
,webkitTapHighlightColor
,webkitTextSizeAdjust
,zoom
getContextAttributes
read
,write
initCompositionEvent
item
pictureInPictureEnabled
,rootElement
,exitPictureInPicture
,hasStorageAccess
,requestStorageAccess
caretPositionFromPoint
,getAnimations
part
msGetRegionContent
webkitRelativePath
hand
,pose
pulse
captureStream
transferControlToOffscreen
outerText
requestSubmit
allowPaymentRequest
capture
,webkitEntries
,webkitdirectory
onbounce
,onfinish
,onstart
disableRemotePlayback
,remote
form
disablePictureInPicture
,onenterpictureinpicture
,onleavepictureinpicture
,requestPictureInPicture
request
databases
commit
dataTransfer
,getTargetRanges
initKeyboardEvent
char
pseudoElement
getDisplayMedia
contentHint
initMessageEvent
mediaCapabilities
,mediaSession
activeVRDisplays
,msManipulationViewsEnabled
,msMaxTouchPoints
,msPointerEnabled
,getUserMedia
,getVRDisplays
,msLaunchUri
,msSaveBlob
,msSaveOrOpenBlob
namespaceURI
actions
,badge
,image
,renotify
,requireInteraction
,silent
,timestamp
,vibrate
onshippingaddresschange
,onshippingoptionchange
,shippingAddress
,shippingOption
,shippingType
onpayerdetailchange
,payerEmail
,payerName
,payerPhone
,shippingAddress
,shippingOption
,addEventListener
,removeEventListener
detail
detail
expirationTime
userVisibleOnly
iceTransport
,onerror
,getRemoteCertificates
address
ongatheringstatechange
,onselectedcandidatepairchange
,onstatechange
,role
,getLocalCandidates
,getLocalParameters
,getRemoteCandidates
,getRemoteParameters
,getSelectedCandidatePair
,addEventListener
,removeEventListener
idpErrorInfo
,idpLoginUrl
,peerIdentity
,sctp
,getIdentityAssertion
,setIdentityProvider
setCodecPreferences
forEach
isHistoryNavigation
,isReloadNavigation
trailer
rel
,relList
beginElement
,beginElementAt
,endElement
,endElementAt
pathSegList
,getPointAtLength
,getTotalLength
onunload
,onzoom
,getComputedStyle
length
viewTarget
disposition
,sample
navigationPreload
,sync
delegatesFocus
changeType
initStorageEvent
fontBoundingBoxAscent
,fontBoundingBoxDescent
altitudeAngle
,azimuthAngle
,touchType
initUIEvent
corruptedVideoFrames
cancelIdleCallback
,requestIdleCallback
applicationCache
,defaultStatus
,doNotTrack
,msContentScript
,offscreenBuffering
,oncompassneedscalibration
,ondeviceorientationabsolute
,ongamepadconnected
,ongamepaddisconnected
,onmousewheel
,onreadystatechange
,onvrdisplayactivate
,onvrdisplayblur
,onvrdisplayconnect
,onvrdisplaydeactivate
,onvrdisplaydisconnect
,onvrdisplaypresentchange
,styleMedia
,departFocus
,getMatchedCSSRules
,msWriteProfilerMark
,webkitCancelAnimationFrame
,webkitConvertPointFromNodeToPage
,webkitConvertPointFromPageToNode
,webkitRequestAnimationFrame
close
Non-value types
signal
colorSpace
,willReadFrequently
startTime
playbackRate
dataTransfer
,targetRanges
pseudoElement
encryptionScheme
preferCurrentTab
cursor
,displaySurface
,logicalSurface
suppressLocalAudioPlayback
autoGainControl
,noiseSuppression
,resizeMode
restrictOwnAudio
autoGainControl
,channelCount
,latency
,noiseSuppression
,resizeMode
suppressLocalAudioPlayback
autoGainControl
,channelCount
,latency
,noiseSuppression
,resizeMode
playbackRate
shippingOptions
error
,payerErrors
,shippingAddressErrors
payer
,shippingAddress
bytesDiscardedOnSend
,circuitBreakerTriggerCount
,consentExpiredTimestamp
,consentRequestsSent
,currentRtt
,firstRequestTimestamp
,lastPacketReceivedTimestamp
,lastPacketSentTimestamp
,lastRequestTimestamp
,lastResponseTimestamp
,packetsDiscardedOnSend
,packetsReceived
,packetsSent
,priority
,retransmissionsReceived
,retransmissionsSent
,totalRtt
errorText
statusText
priority
degradationPreference
voiceActivityFlag
iceRole
,packetsReceived
,packetsSent
,selectedCandidatePairChanges
,tlsGroup
disposition
,sample
slotAssignment
files
which
"remove"
scrollPathIntoView
pictureInPictureElement
,getAnimations
caretPositionFromPoint
,caretRangeFromPoint
,elementFromPoint
,elementsFromPoint
,getSelection
"formdata"
,"webkitanimationend"
,"webkitanimationiteration"
,"webkitanimationstart"
,"webkittransitionend"
"cancel"
,"dragexit"
onformdata
,onwebkitanimationend
,onwebkitanimationiteration
,onwebkitanimationstart
,onwebkittransitionend
oncancel
,ondragexit
,onsecuritypolicyviolation
unregisterProtocolHandler
replaceChildren
"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
,ongamepaddisconnected
crossOriginIsolated
memory
,exception
"applet"
"animate"
,"animateMotion"
,"animateTransform"
,"feDropShadow"
,"mpath"
,"set"
index.iterable.d.ts
Non-value types
vibrate
I tried upgrading from TS 4.3.5 to 4.4.2 today and encountered two issues:
HTMLDialogElement
went 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 HTMLDialogElement
no longer works as a type guard.HTMLInputElement.autofocus
was 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 theHTMLInputElement
type to work around this.It would be great if these changes could be reverted.