question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript 4.4 libdom changes

See original GitHub issue

Beta

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 version 0.0.1 which corresponds to the version of libdom.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 issue

    We’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:open
  • Created 2 years ago
  • Reactions:2
  • Comments:69 (24 by maintainers)

github_iconTop GitHub Comments

17reactions
ortacommented, Aug 28, 2021

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

  • Animation
    • Added: onremove, replaceState, commitStyles, persist
  • AudioContext
    • Removed: outputLatency, createMediaStreamTrackSource
  • CSSStyleDeclaration
    • Added: 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
    • Removed: glyphOrientationVertical, maskComposite, maskImage, maskPosition, maskRepeat, maskSize, rubyAlign, textJustify, webkitTapHighlightColor, webkitTextSizeAdjust, zoom
  • CanvasRenderingContext2D
    • Added: getContextAttributes
  • Clipboard
    • Added: read, write
  • CompositionEvent
    • Added: initCompositionEvent
  • DataTransferItemList
    • Removed: item
  • Document
    • Added: pictureInPictureEnabled, rootElement, exitPictureInPicture, hasStorageAccess, requestStorageAccess
    • Removed: caretPositionFromPoint, getAnimations
  • Element
    • Added: part
    • Removed: msGetRegionContent
  • File
    • Added: webkitRelativePath
  • Gamepad
    • Removed: hand, pose
  • GamepadHapticActuator
    • Removed: pulse
  • HTMLCanvasElement
    • Added: captureStream
    • Removed: transferControlToOffscreen
  • HTMLElement
    • Added: outerText
  • HTMLFormElement
    • Added: requestSubmit
  • HTMLIFrameElement
    • Removed: allowPaymentRequest
  • HTMLInputElement
    • Added: capture, webkitEntries, webkitdirectory
  • HTMLMarqueeElement
    • Removed: onbounce, onfinish, onstart
  • HTMLMediaElement
    • Added: disableRemotePlayback, remote
  • HTMLOptGroupElement
    • Removed: form
  • HTMLVideoElement
    • Added: disablePictureInPicture, onenterpictureinpicture, onleavepictureinpicture, requestPictureInPicture
  • IDBCursor
    • Added: request
  • IDBFactory
    • Added: databases
  • IDBTransaction
    • Added: commit
  • InputEvent
    • Added: dataTransfer, getTargetRanges
  • KeyboardEvent
    • Added: initKeyboardEvent
    • Removed: char
  • KeyframeEffect
    • Added: pseudoElement
  • MediaDevices
    • Added: getDisplayMedia
  • MediaStreamTrack
    • Added: contentHint
  • MessageEvent
    • Added: initMessageEvent
  • Navigator
    • Added: mediaCapabilities, mediaSession
    • Removed: activeVRDisplays, msManipulationViewsEnabled, msMaxTouchPoints, msPointerEnabled, getUserMedia, getVRDisplays, msLaunchUri, msSaveBlob, msSaveOrOpenBlob
  • Node
    • Removed: namespaceURI
  • Notification
    • Removed: actions, badge, image, renotify, requireInteraction, silent, timestamp, vibrate
  • PaymentRequest
    • Removed: onshippingaddresschange, onshippingoptionchange, shippingAddress, shippingOption, shippingType
  • PaymentResponse
    • Removed: onpayerdetailchange, payerEmail, payerName, payerPhone, shippingAddress, shippingOption, addEventListener, removeEventListener
  • PerformanceMark
    • Added: detail
  • PerformanceMeasure
    • Added: detail
  • PushSubscription
    • Removed: expirationTime
  • PushSubscriptionOptions
    • Removed: userVisibleOnly
  • RTCDtlsTransport
    • Removed: iceTransport, onerror, getRemoteCertificates
  • RTCIceCandidate
    • Added: address
  • RTCIceTransport
    • Removed: ongatheringstatechange, onselectedcandidatepairchange, onstatechange, role, getLocalCandidates, getLocalParameters, getRemoteCandidates, getRemoteParameters, getSelectedCandidatePair, addEventListener, removeEventListener
  • RTCPeerConnection
    • Removed: idpErrorInfo, idpLoginUrl, peerIdentity, sctp, getIdentityAssertion, setIdentityProvider
  • RTCRtpTransceiver
    • Removed: setCodecPreferences
  • ReadableStream
    • Added: forEach
  • Request
    • Removed: isHistoryNavigation, isReloadNavigation
  • Response
    • Removed: trailer
  • SVGAElement
    • Added: rel, relList
  • SVGAnimationElement
    • Added: beginElement, beginElementAt, endElement, endElementAt
  • SVGPathElement
    • Removed: pathSegList, getPointAtLength, getTotalLength
  • SVGSVGElement
    • Removed: onunload, onzoom, getComputedStyle
  • SVGTransformList
    • Added: length
  • SVGViewElement
    • Removed: viewTarget
  • SecurityPolicyViolationEvent
    • Added: disposition, sample
  • ServiceWorkerRegistration
    • Removed: navigationPreload, sync
  • ShadowRoot
    • Added: delegatesFocus
  • SourceBuffer
    • Added: changeType
  • StorageEvent
    • Added: initStorageEvent
  • TextMetrics
    • Added: fontBoundingBoxAscent, fontBoundingBoxDescent
  • Touch
    • Removed: altitudeAngle, azimuthAngle, touchType
  • UIEvent
    • Added: initUIEvent
  • VideoPlaybackQuality
    • Added: corruptedVideoFrames
  • Window
    • Added: cancelIdleCallback, requestIdleCallback
    • Removed: 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
  • WritableStream
    • Added: close

Non-value types

  • AddEventListenerOptions
    • Added: signal
  • CanvasRenderingContext2DSettings
    • Added: colorSpace, willReadFrequently
  • ComputedEffectTiming
    • Added: startTime
  • EffectTiming
    • Added: playbackRate
  • InputEventInit
    • Added: dataTransfer, targetRanges
  • KeyframeEffectOptions
    • Added: pseudoElement
  • MediaKeySystemMediaCapability
    • Added: encryptionScheme
  • MediaStreamConstraints
    • Added: preferCurrentTab
  • MediaTrackCapabilities
    • Added: cursor, displaySurface, logicalSurface
  • MediaTrackConstraintSet
    • Added: suppressLocalAudioPlayback
    • Removed: autoGainControl, noiseSuppression, resizeMode
  • MediaTrackSettings
    • Added: restrictOwnAudio
    • Removed: autoGainControl, channelCount, latency, noiseSuppression, resizeMode
  • MediaTrackSupportedConstraints
    • Added: suppressLocalAudioPlayback
    • Removed: autoGainControl, channelCount, latency, noiseSuppression, resizeMode
  • OptionalEffectTiming
    • Added: playbackRate
  • PaymentDetailsBase
    • Removed: shippingOptions
  • PaymentDetailsUpdate
    • Removed: error, payerErrors, shippingAddressErrors
  • PaymentValidationErrors
    • Removed: payer, shippingAddress
  • RTCIceCandidatePairStats
    • Removed: bytesDiscardedOnSend, circuitBreakerTriggerCount, consentExpiredTimestamp, consentRequestsSent, currentRtt, firstRequestTimestamp, lastPacketReceivedTimestamp, lastPacketSentTimestamp, lastRequestTimestamp, lastResponseTimestamp, packetsDiscardedOnSend, packetsReceived, packetsSent, priority, retransmissionsReceived, retransmissionsSent, totalRtt
  • RTCPeerConnectionIceErrorEventInit
    • Added: errorText
    • Removed: statusText
  • RTCRtpEncodingParameters
    • Added: priority
  • RTCRtpSendParameters
    • Added: degradationPreference
  • RTCRtpSynchronizationSource
    • Removed: voiceActivityFlag
  • RTCTransportStats
    • Removed: iceRole, packetsReceived, packetsSent, selectedCandidatePairChanges, tlsGroup
  • SecurityPolicyViolationEventInit
    • Added: disposition, sample
  • ShadowRootInit
    • Added: slotAssignment
  • ShareData
    • Added: files
  • UIEventInit
    • Added: which
  • AnimationEventMap
    • Added: "remove"
  • CanvasUserInterface
    • Removed: scrollPathIntoView
  • DocumentOrShadowRoot
    • Added: pictureInPictureElement, getAnimations
    • Removed: caretPositionFromPoint, caretRangeFromPoint, elementFromPoint, elementsFromPoint, getSelection
  • GlobalEventHandlersEventMap
    • Added: "formdata", "webkitanimationend", "webkitanimationiteration", "webkitanimationstart", "webkittransitionend"
    • Removed: "cancel", "dragexit"
  • GlobalEventHandlers
    • Added: onformdata, onwebkitanimationend, onwebkitanimationiteration, onwebkitanimationstart, onwebkittransitionend
    • Removed: oncancel, ondragexit, onsecuritypolicyviolation
  • NavigatorContentUtils
    • Removed: unregisterProtocolHandler
  • ParentNode
    • Added: replaceChildren
  • PaymentRequestEventMap
    • Removed: "shippingaddresschange", "shippingoptionchange"
  • RTCDtlsTransportEventMap
    • Removed: "error"
  • SVGSVGElementEventMap
    • Removed: "SVGUnload", "SVGZoom"
  • WindowEventMap
    • Removed: "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"
  • WindowEventHandlersEventMap
    • Added: "gamepadconnected", "gamepaddisconnected"
  • WindowEventHandlers
    • Added: ongamepadconnected, ongamepaddisconnected
  • WindowOrWorkerGlobalScope
    • Added: crossOriginIsolated
  • Console
    • Removed: memory, exception
  • HTMLElementTagNameMap
    • Removed: "applet"
  • SVGElementTagNameMap
    • Added: "animate", "animateMotion", "animateTransform", "feDropShadow", "mpath", "set"

index.iterable.d.ts

Non-value types

  • Navigator
    • Added: vibrate
9reactions
IceCreamYoucommented, Aug 27, 2021

I tried upgrading from TS 4.3.5 to 4.4.2 today and encountered two issues:

  1. 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 write declare var HTMLDialogElement: HTMLDialogElement; to allow using it as a value, but then element instanceof HTMLDialogElement no longer works as a type guard.
  2. 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 the HTMLInputElement type to work around this.

It would be great if these changes could be reverted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 4.4
You can consult our list of known lib.dom.d.ts changes to understand what is impacted. More-Compliant Indirect Calls for Imported Functions. In earlier ...
Read more >
Announcing TypeScript 4.4 - Microsoft Developer Blogs
That's why TypeScript 4.4 introduces a new flag called --useUnknownInCatchVariables . This flag changes the default type of catch clause ...
Read more >
The New Features and Breaking Changes in TypeScript 4.4
The New Features and Breaking Changes in TypeScript 4.4. Control flow analysis, symbols as index signatures, spelling suggestions, and more.
Read more >
TypeScript 4.4: The Good, The Bad and The Not So Bad
ts has changed to be in line with current specifications (especially the lib.dom.d.ts with all changes noted here). With that out of the...
Read more >
The Definitive TypeScript 4.8 Guide - SitePen
Changing the previous example to use an interface would look like this: ... Before TypeScript 4.4, as in JavaScript, it is only possible...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found