Repository navigation
Inconsistents with ClientRect definition #11085
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this
on Dec 16, 2016 PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.
I'd be willing to do this. It seems pretty straightforward. If I understand the spec correctly, there are two properties missing x and y.
X, Y, width and height should not be readonly and the others should.
Also, about the name, which is now DOMRect, should I rename it? Or should I just create a new interface and make one inherit from the other?
Pull request: microsoft/TypeScript-DOM-lib-generator#299
Reacted by Holger JeromingetBoundingClientRect().xgives meError:(19, 30) TS2339: Property 'x' does not exist on type 'ClientRect | DOMRect'. Property 'x' does not exist on type 'ClientRect'.How come has not been fixed yet?
Reacted by Riyad Shauk, Dennis Brotzky, Zsolt Gulyas and Pavan ReddyHolgerJeromin commented
on Sep 12, 2018 ContributorAuthorMore actionsTo be backward compatible getBoundingClientRect returns the old and new interface:
let unspecifiedRect = document.body.getBoundingClientRect(); unspecifiedRect.x // fails let domRect = document.body.getBoundingClientRect() as DOMRect; domRect.x // worksReacted by Zsolt GulyasReacted by Riyad Shauk, Sebastián Ferreras, Robert Fohlin-Axelsson, Viktor Blöndal, Sander, quisi.do, Dennis Brotzky, Jeff See, tnicola, ezjoke and 1 moreReacted by Zsolt Gulyas and DmitryReacted by Zsolt Gulyas- locked as resolved and limited conversation to collaborators
on Oct 21, 2025
TypeScript Version: 2.0.3
Typescript 2.0.3 has a lot of readonly stuff in lib.d.ts.
I am surprised that only height and width is readonly in ClientRect definition.
Is this an error?
Mozillas response of getBoundingClientRect is the other way round:
all but height/width readonly (if i can trust FireBug) and has added x, y
Sidenote: ClientRect has been renamed to DOMRect