Skip to content

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

Closed
@muj-beg

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

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