Skip to content

Regression in nightly build use of this type? #12490

@myitcv

Description

@myitcv

Easiest explained via the repro steps:

$ cd `mktemp -d`
$ npm init --force
$ npm install --save-dev typescript@2.2.0-dev.20161122
$ grep -r 'onload:' node_modules/typescript/lib/
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: this, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: this, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: this, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: this, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: this, ev: Event) => any;
....

But then

$ npm install --save-dev typescript@2.2.0-dev.20161124
$ grep -r 'onload:' node_modules/typescript/lib/
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: Document, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: HTMLBodyElement, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: HTMLElement, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: HTMLFrameElement, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: HTMLFrameSetElement, ev: Event) => any;
node_modules/typescript/lib/lib.es6.d.ts:    onload: (this: HTMLIFrameElement, ev: Event) => any;
...

This has the obvious impact:

let image = new Image();

// with typescript@2.2.0-dev.20161122
image.onload // has type HTMLElement.onload: (this: HTMLImageElement, ev: Event) => any

// with typescript@2.2.0-dev.20161124
image.onload // has type HTMLElement.onload: (this: HTMLElement, ev: Event) => any

Is this an intentional change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions