Skip to content

Wrong assigment is not flagged by compiler #19820

Closed
@dbaeumer

Description

@dbaeumer

TypeScript Version: 2.6.1
Code

interface A {
	x: number;
}

interface B {
	y: number;
}

function onEvent(callback: (param: A) => void): void {
}

onEvent((param: A & B) => {
	console.log('Hello');
});

Expected behavior:

  • passing the arrow function to onEvent should be flagged as an error

Actual behavior:

  • it is not flagged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions