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 [email protected]
$ 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 [email protected]
$ 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 [email protected]
image.onload // has type HTMLElement.onload: (this: HTMLImageElement, ev: Event) => any

// with [email protected]
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
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions