Skip to content

Global variable event: Event in lib.es6.d.ts #11583

Closed
microsoft/TypeScript-DOM-lib-generator
#159
@sod

Description

@sod

TypeScript Version: 2.0.3

Code

tsconfig.json includes lib es6:

{
    "compilerOptions": {
        "lib": [
            "es6",
            "dom"
        ]
    },
}
function eventHandler() {
    // typescript doesn't complain about missing event variable, because event is declared as global in lib.es6.d.ts
    console.log(event.target);
}

Expected behavior:

Don't expect event to exist on the global object. Couldn't reproduce it in Safari, Firefox or Chrome. It's always console.log(window.event); // undefined

Actual behavior:

event: Event is declared as global variable in lib.es6.d.ts
https://github.com/Microsoft/TypeScript/blob/2e7c83abc833534181d97c534bfac865cd93b1f0/lib/lib.es6.d.ts#L18680
https://github.com/Microsoft/TypeScript/blob/2e7c83abc833534181d97c534bfac865cd93b1f0/lib/lib.es6.d.ts#L20129

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions