Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect event property in Window #8809

Closed
Avol-V opened this issue May 25, 2016 · 2 comments
Closed

Incorrect event property in Window #8809

Avol-V opened this issue May 25, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@Avol-V
Copy link

Avol-V commented May 25, 2016

Property event in global object Window is non-standard and must be removed from lib.d.ts because of possible errors in browsers that follow the standard (Mozilla Firefox, for example).

It's also an ability for potential wrong behavior in code (example below).

TypeScript Version:

1.7.5 / current Git code.

Code

function someHandler( event: Event, additionalData: number ): void
{
    console.log( event, additionalData );
}

const onClick = (): void => someHandler( event, 1 ); // <-- forgot the argument `event`

element.addEventListener( 'click', onClick );

Expected behavior:

Error — event is not defined.

Actual behavior:

Silence but code may work incorrectly and didn't work in some browsers.

@kitsonk
Copy link
Contributor

kitsonk commented May 25, 2016

Essentially a duplicate of #1351 which deals with a lack of errors with referencing an accidental global versus a locally scoped variable or parameter.

"must be removed" is subjective, as it is non-standard, but it is present in many environments.

@mhegazy
Copy link
Contributor

mhegazy commented May 25, 2016

closing in favor of #1351

@mhegazy mhegazy closed this as completed May 25, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label May 25, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants