TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

TypeScript 4.4 libdom changes

Open orta opened this issue 4 years ago • 69 comments

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

orta avatar Jun 27 '21 21:06 orta

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

orta avatar Jun 27 '21 21:06 orta

The following four types also seems to be removed, but are not mentioned in the above list :

  • AudioParamDescriptor
  • RTCInboundRTPStreamStats
  • RTCMediaStreamTrackStats
  • RTCStatsCallback

h-joo avatar Jul 16 '21 14:07 h-joo

@types/[email protected] should be the version which is shipped with TS 4.4rc

orta avatar Aug 11 '21 11:08 orta

Found undocumented breaking change: PermissionName has less union members than 4.3 which cause the following code type error.

navigator.permissions.query({ name: 'camera' })

See: https://w3c.github.io/permissions/#enumdef-permissionname

Jack-Works avatar Aug 14 '21 09:08 Jack-Works

Breaking change documented wrong:

CryptoKeyPair didn't get removed.

// 4.3
interface CryptoKeyPair {
    privateKey: CryptoKey;
    publicKey: CryptoKey;
}
// 4.4
interface CryptoKeyPair {
    privateKey?: CryptoKey;
    publicKey?: CryptoKey;
}

Jack-Works avatar Aug 14 '21 09:08 Jack-Works

ClipboardItem constructor type is wrong. According to MDN, it should be string | Blob | Promise<string | Blob>.

In 4.3 it is string | Blob, in 4.4 it is Promise<string | Blob> which is wrong.

Jack-Works avatar Aug 14 '21 09:08 Jack-Works

Found undocumented breaking change: PermissionName has less union members than 4.3 which cause the following code type error.

navigator.permissions.query({ name: 'camera' })

See: https://w3c.github.io/permissions/#enumdef-permissionname

Camera permission is at risk because of lack of multiple implementation, so I guess the work item is to document the removal.

ClipboardItem constructor type is wrong. According to MDN, it should be string | Blob | Promise<string | Blob>.

In 4.3 it is string | Blob, in 4.4 it is Promise<string | Blob> which is wrong.

#1102

saschanaz avatar Aug 14 '21 20:08 saschanaz

I want to add (deprecated: ref #884) mouseWheelEvent to the list of removed types

HolgerJeromin avatar Aug 27 '21 11:08 HolgerJeromin

Undocumented change msSaveBlob was removed from window.navigator in TypeScript 4.4.2.

busches avatar Aug 27 '21 13:08 busches

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.

IceCreamYou avatar Aug 27 '21 21:08 IceCreamYou

  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.

Chrome/Edge/Opera all uses the same engine Blink and no other engine supports it without a flag, that is why. Please refer to https://github.com/microsoft/TypeScript-DOM-lib-generator#when-the-type-is-missing for the reasoning here.

  1. 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.

Fixed by #1111

saschanaz avatar Aug 27 '21 22:08 saschanaz

Thanks, I read that section of the README but it's not clear about flagged features, plus <dialog> is enabled by default in Firefox Nightly.

IceCreamYou avatar Aug 28 '21 01:08 IceCreamYou

Why was hashchange event removed? Now there is only Event which doesn't have newURL property: https://www.typescriptlang.org/play?ts=4.4.2#code/O4SwdgJg9sB0CGEIFEBuBTMAXAMiAzlpugE4AUA5ABbz5UDGNYA5uhQDQAEZ6AXJwAlaVAMJNWaTFgCUnALwA+TgG90sMOmABVAEo4AvtKA

Juraj-Masiar avatar Aug 30 '21 11:08 Juraj-Masiar

Why was hashchange event removed? Now there is only Event which doesn't have newURL property: https://www.typescriptlang.org/play?ts=4.4.2#code/O4SwdgJg9sB0CGEIFEBuBTMAXAMiAzlpugE4AUA5ABbz5UDGNYA5uhQDQAEZ6AXJwAlaVAMJNWaTFgCUnALwA+TgG90sMOmABVAEo4AvtKA

Fixed by #1104

saschanaz avatar Aug 30 '21 11:08 saschanaz

Location#reload(forcedReload: boolean): void was removed as well. Was that intended?

kindlich avatar Aug 30 '21 12:08 kindlich

Location#reload(forcedReload: boolean): void was removed as well. Was that intended?

It's currently a Firefox specific extension, so yes, that was intended.

saschanaz avatar Aug 30 '21 12:08 saschanaz

Hello, speech recognition apis have been removed but i don't find informations about deprecation of this technology.

is there a remplacement api ?

icepower03 avatar Aug 30 '21 15:08 icepower03

Hello, speech recognition apis have been removed but i don't find informations about deprecation of this technology.

is there a remplacement api ?

It's not deprecated, it's just not mature enough with no prefix-less implementation and being still in WICG (where immature specifications exist).

saschanaz avatar Aug 30 '21 15:08 saschanaz

Just a query, maybe my bad understanding, but File.webkitRelativePath is not a standard property and, according to MDN, should NOT be used on production sites. Can this be made optional or removed (or is my understanding here wrong)? https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath

daggmano avatar Sep 01 '21 05:09 daggmano

I believe ClipboardItem constructor should be restricted to only accept Blob. Blink has only partial support for ClipboardItem - as per MDN:

The ClipboardItem constructor only accepts a blob as the item data, but not strings or Promises that resolve to strings or blobs. See bug 1014310.

pbadenski avatar Sep 03 '21 12:09 pbadenski

I believe ClipboardItem constructor should be restricted to only accept Blob. Blink has only partial support for ClipboardItem - as per MDN:

The ClipboardItem constructor only accepts a blob as the item data, but not strings or Promises that resolve to strings or blobs. See bug 1014310.

Makes sense, do you want to write a patch?

saschanaz avatar Sep 04 '21 13:09 saschanaz

sorry for the noob question: how is it decided which interfaces get added or removed? at what point do changes usually end up in microsoft/TypeScript?

the new TS features are great, but sadly all the dom type changes are a bit of a disincentive to upgrade for me at the moment. for example, some code that I work on uses RTCSctpTransport which is still in the spec, has no "feature at risk" annotation, and still works in chrome :/

nonetheless thanks for all the great work.

dhaigh avatar Sep 06 '21 02:09 dhaigh

Mostly based on MDN browser compatibility data. For example, RTCSctpTransport is marked as Chrome(ium)-only on MDN: https://developer.mozilla.org/en-US/docs/Web/API/RTCSctpTransport#browser_compatibility

saschanaz avatar Sep 06 '21 02:09 saschanaz

FYI at Chrome DevTools we have started our attempts to upgrade to TypeScript 4.4.2, but sadly this issue is one the major timesinks for this release. Initial big hitters are:

  • getSelection removed from ShadowRoot
  • getElementFromPoint removed from ShadowRoot
  • Removed DOMError
  • unknown in catch (but we were able to turn off the config setting for this 👍 )

Unfortunately, adding @types/web isn't as straightforward for us and also does not appear to resolve the situation for us where we rely on Chromium-only API's. That said, Chrome DevTools is probably in a special situation where we run on a single engine, so sometimes we use modern API's that are not supported on other engines just yet.

It seems like our Google internal team ran into similar issues before: https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1067 But since we use a different stack and upgrade TypeScript at our own pace, we ran into this later than them.

TimvdLippe avatar Sep 08 '21 12:09 TimvdLippe

I think the correct approach would be to add @deprecated with an explanation to the functions or properties that will be removed in the next major release. With this approach, developers will be able to see that object.~~deprecated~~ is going to be removed and can raise their concerns before the removal happens.

With the current approach, you need won't realize that a change is coming if you are not actively using the beta or RC version of TypeScript, because in 4.3 the function exists and in 4.4 the function is gone.

mrttrifork avatar Sep 08 '21 13:09 mrttrifork

4.4 was a special release that trimmed a lot of nonstandard things, I think any future releases will follow W3C/WHATWG deprecation step.

saschanaz avatar Sep 08 '21 14:09 saschanaz

The removal of autoGainControl and noiseSuppression caused a build break. This is supported in most browsers and outlined in W3C Capture Streams - https://www.w3.org/TR/mediacapture-streams/#dom-mediatracksupportedconstraints-autogaincontrol Can you provide any insight into why it was removed?

berickson1 avatar Sep 14 '21 22:09 berickson1

The removal of the userVisibleOnly property from the PushSubscriptionOptions interface caused issues in a project where WebPush is being used. Chrome & Edge still require userVisibleOnly to be set when calling PushManager.subscribe() or the call will fail. userVisibleOnly is also still documented in the latest W3C Push API Draft: https://www.w3.org/TR/push-api/#pushsubscriptionoptions-interface. Is there a reason why this property was removed?

dylancrockett avatar Sep 16 '21 21:09 dylancrockett

The removal of autoGainControl and noiseSuppression caused a build break. This is supported in most browsers and outlined in W3C Capture Streams - https://www.w3.org/TR/mediacapture-streams/#dom-mediatracksupportedconstraints-autogaincontrol Can you provide any insight into why it was removed?

Seems they are supported on Firefox and Chrome. PR welcome.

userVisibleOnly is also still documented in the latest W3C Push API Draft: https://www.w3.org/TR/push-api/#pushsubscriptionoptions-interface. Is there a reason why this property was removed?

Yes: https://github.com/microsoft/TypeScript-DOM-lib-generator#why-is-my-fancy-api-still-not-available-here

See MDN for the data. Note that PushSubscrptionOptionsInit still has userVisibleOnly so the option still can be set. (Logically it shouldn't exist either but there is no good way to autodetect dictionary member support.)

saschanaz avatar Sep 16 '21 22:09 saschanaz

Why did you remove OffscreenCanvas? It is available in Edge, Chrome and Opera.

ova2 avatar Sep 17 '21 08:09 ova2