Skip to content

Using decorators together with ClientRect type fails on Chrome v61. #18615

Description

@muj-beg

TypeScript Version: 2.5.2

Code

function someDecorator(target, key) {
}

class MyClass {
  @someDecorator
  field: ClientRect;
}

The transpiled output contains the following code:

__decorate([
    someDecorator,
    __metadata("design:type", ClientRect)
], Greeter.prototype, "field", void 0);

Expected behavior:
Runs without error on Chrome v61+.

Actual behavior:
Running the above code in Chrome v61 fails with the error: Uncaught ReferenceError: ClientRect is not defined.

This is due to two related issues:

  1. Chrome replaced ClientRect with DOMRect: https://groups.google.com/a/chromium.org/forum/#!msg/blink-reviews/vxvUqqj2Gnw/4sbTv97SBgAJ
  2. lib.d.ts hasn't been updated to reflect the above change. Inconsistents with ClientRect definition #11085

Activity

  1. changed the title [-]Using decorators together with `ClientRect` fails on Chrome v61.[/-] [+]Using decorators together with `ClientRect` type fails on Chrome v61.[/+] on Sep 20, 2017
  2. gbilodeau commented on Sep 21, 2017

    @gbilodeau

    We observed the same behavior today.

  3. mhegazy commented on Sep 21, 2017

    @mhegazy
    Contributor

    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.

  4. added this to the milestone on Sep 21, 2017
  5. muj-beg commented on Sep 24, 2017

    @muj-beg
    Author

    Mohamed Hegazy (@mhegazy) Submitted pull request: microsoft/TypeScript-DOM-lib-generator#299.
    However, the Travis CI build error seems related to the F# NuGet package download failure. Not sure what to do about that.

  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions