# Feedback to the TypeScript team for TypeScript 4.4-beta This GitHub issue contains feedback on the TS 4.4-beta release from the team that is responsible for keeping Google's internal software working with the latest version of TypeScript. During the 4.4-beta migration, we have ran into some issues. Especially some changes made in lib.dom.d.ts will make it diffilcut for Google to migrate. We've listed the breaking changes which we weren't able to easily migrate in the following section. ## Breakages which are complicated to migrate Each subsection in this section contains a diagnosis of the breakage and a link to the github issue if available. ### canvas API changes in WebGL WebGL2RenderingContext no longer seems to have a .canvas field, however the WebGLRenderingContext does have one. TS now doesn't list one on either API. There seems to be a [github issue](https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1050) related to the failure, and it seems it has been fixed already. ### 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/DefinitelyTyped/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. * https://github.com/microsoft/TypeScript/blob/release-4.3/lib/lib.dom.d.ts#L4995 * https://github.com/microsoft/TypeScript/blob/release-4.4/lib/lib.dom.d.ts#L4725 ## Impact summary (trivial fix unavailable) Change description | Libraries affected --------------------------------------------------- | -----------------: type of ariaLabel is string rather than string/null | 0.079% ShadowRoot interface changes | 0.034% OffscreenCanvas Rendering API changes | 0.014% Removed Types | 0.009% Newly readonly attributes | 0.008% DocumentOrShadowRoot interface changes | 0.005% ChildNode interface changes | 0.004% canvas API changes | 0.004% ## Impact summary (trivial fix available) Change description | Libraries affected --------------------------------------------------- | -----------------: window.parent nullability changes | 0.088% misc and other changes | 0.088% Various Media Related API changes | 0.019% window.location.reload interface changes | 0.014% Navigator API changes | 0.012% Promise always evaluate to true or false | 0.011% CustomElementConstructor interface changes | 0.010% Property has no initializer | 0.008% Infinite depth type inference | 0.002% property specified more than once in object literal | 0.002% document.createTreeWalker interface changes | 0.001%