Skip to content

Lack of type checking for callback parameters #15579

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'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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