Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript 4.4 libdom changes #1029

Open
orta opened this issue Jun 27, 2021 · 69 comments
Open

TypeScript 4.4 libdom changes #1029

orta opened this issue Jun 27, 2021 · 69 comments

Comments

@orta
Copy link
Contributor

orta commented Jun 27, 2021

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 microsoft/TypeScript#44795

@orta
Copy link
Contributor Author

orta commented Jun 27, 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

@h-joo
Copy link

h-joo commented Jul 16, 2021

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

  • AudioParamDescriptor
  • RTCInboundRTPStreamStats
  • RTCMediaStreamTrackStats
  • RTCStatsCallback

@orta
Copy link
Contributor Author

orta commented Aug 11, 2021

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

@Jack-Works
Copy link

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
Copy link

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
Copy link

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.

@saschanaz
Copy link
Contributor

saschanaz commented Aug 14, 2021

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

@HolgerJeromin
Copy link

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

@busches
Copy link

busches commented Aug 27, 2021

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

@IceCreamYou
Copy link

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.

@saschanaz
Copy link
Contributor

saschanaz commented Aug 27, 2021

  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

@IceCreamYou
Copy link

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.

@Juraj-Masiar
Copy link

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

@saschanaz
Copy link
Contributor

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

@kindlich
Copy link

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

@saschanaz
Copy link
Contributor

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

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

@icepower03
Copy link

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

is there a remplacement api ?

@saschanaz
Copy link
Contributor

saschanaz commented Aug 30, 2021

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

@daggmano
Copy link

daggmano commented Sep 1, 2021

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

@JohnDeved
Copy link

I had working SpeechRecognition types before, but with 4.4, and 4.5 I don't even using this library as lib replacement (npmjs.com/package/@types/web). Is this the intended behavior with the upgrade? Are experimental APIs not in @types/web either?

npm i @types/dom-speech-recognition -D will provide typings

@wessleym
Copy link

I just updated to a newer version of TypeScript, and I found that PushSubscription was missing expirationTime:
https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/expirationTime
I wonder if this is because MDN calls expirationTime "experimental." But it calls the entire PushSubscription class experimental, so I wouldn't think being experimental is a reason for a property to be excluded from TypeScript.
I request that expirationTime be added back to PushSubscription. Thank you.

@saschanaz
Copy link
Contributor

Hi @wessleym, it's added very recently, just 8 days ago: #1335

Please try @types/[email protected] if you need it today.

@wessleym
Copy link

@saschanaz, thank you! If you or anyone else knows when TypeScript itself will be updated with this change, that would be helpful.

@orta
Copy link
Contributor Author

orta commented May 27, 2022

Likely in TypeScript 4.8, so roughly 3 months from now

@wessleym
Copy link

@orta, I see. Thank you.

@Avinash4243
Copy link

Avinash4243 commented May 30, 2022

Hi All - I've been facing the same issue for last 1 week all of them are related to Canvas and Worker. I've resolved few of them like transferControlToOffscreen and offscreenwebworker (coming from typescript -> lib.dom.d.ts ) by using declaration merging technique. But still getting issue like Cannot find name 'OffscreenCanvasRenderingContext2D' and Property 'getContext' does not exist on type 'OffscreenCanvas' even after adding to custom declaration file. This is being referred from typescript -> lib.webworker.d.ts and custom declaration is not working for this.
your help would be much appreciated. Thank you,
image

@tamuratak
Copy link

Touch

Removed: altitudeAngle, azimuthAngle, touchType

They MUST NOT be removed. They are actually defined in the specification.

See https://w3c.github.io/touch-events/#touch-interface

@saschanaz
Copy link
Contributor

saschanaz commented Jun 5, 2022

They MUST NOT be removed. They are actually defined in the specification.

Please check README. (And MDN browser compatibility)

@tamuratak
Copy link

I see. You should edit the following too:

interface TouchInit {
altitudeAngle?: number;
azimuthAngle?: number;
clientX?: number;
clientY?: number;
force?: number;
identifier: number;
pageX?: number;
pageY?: number;
radiusX?: number;
radiusY?: number;
rotationAngle?: number;
screenX?: number;
screenY?: number;
target: EventTarget;
touchType?: TouchType;
}

@TechQuery
Copy link

@orta I find a Type bug of Font Face API: microsoft/TypeScript#51885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests