Google Feedback on 4.4 Beta
See original GitHub issueOpening on the behalf of @h-joo from https://github.com/microsoft/TypeScript/issues/45047:
Readonly attributes in DOMPoint, DOMMatrix, DOMRect
Some properties of DOMPoint, DOMMatrix, DOMRect became readonly, and this no longer match the specification. This is because these types no longer override properties from the extended types to be read/write.
Compare(DOMPoint):
- https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L3979
- https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L3886
Compare(DOMMatrix):
- https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L3854
- https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L3783
Compare(DOMRect):
- https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L4026
- https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L3929
Removed Types
SpeechRecognition, RTCError got removed from lib.dom.d.ts. There are existing code which use this API, and it would be difficult to migrate without proper type support either from the compiler or from definitelyTyped.
- https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognitionEvent
- https://developer.mozilla.org/en-US/docs/Web/API/RTCError
Offscreen Rendering API changes
OffscreenCanvas still exists, but it’s marked as deprecated. Though it is no longer a value, i.e. code calling
new OffscreenCanvas
no longer works, it’s just an interface. We think this might be unintentional. Though, we would still be able to migrate via referring to the types defined in DefinitelyTyped.
- https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L11087
- https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L10832
ShadowRoot interface changes
ShadowRoot is a subtype of DocumentFragment. DocumentFragment has a getElementById which returns HTMLElement. In 4.4-beta, DocumentFragment no longer defines its own getElementById method, meaning HTMLElement.prototype.shadowRoot.getElementById returns Element, not HTMLElement. This causes hundreds of breakages of code using shadowRoot.
- https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L4985
- https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L4717
ChildNode interface changes
In 4.4, ChildNode no longer extends Node. This seems like a bug.
- https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L3531
- https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L3487
DocumentOrShadowRoot interface changes
DocumentOrShadowRoot no longer has getSelection, elementFromPoint, elementsFromPoint, caretFromRange. We also couldn’t find in the repo whether this was intentional or not.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top GitHub Comments
Seems that
elementFromPoint
andelementsFromPoint
should be restored since those are supported everywhere.Great, now all makes sense. Thank you for your help!!