Content-Length: 277030 | pFad | https://github.com/microsoft/TypeScript/issues/15579

9A Lack of type checking for callback parameters · Issue #15579 · microsoft/TypeScript · GitHub
Skip to content

Lack of type checking for callback parameters #15579

Closed
@falsandtru

Description

@falsandtru

TypeScript Version: master

Code

function f(g: (ev: Event) => any) { }
function g(ev: MouseEvent) { }
f(g);
f(ev => g(ev));

Expected behavior:

$ node built/local/tsc.js index.ts --noEmit --strict
index.ts(3,3): error ...
index.ts(4,11): error TS2345: Argument of type 'Event' is not assignable to parameter of type 'MouseEvent'.
  Property 'altKey' is missing in type 'Event'.

Actual behavior:

$ node built/local/tsc.js index.ts --noEmit --strict
index.ts(4,11): error TS2345: Argument of type 'Event' is not assignable to parameter of type 'MouseEvent'.
  Property 'altKey' is missing in type 'Event'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueQuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/microsoft/TypeScript/issues/15579

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy