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

Wrong assigment is not flagged by compiler #19820

Closed
dbaeumer opened this issue Nov 7, 2017 · 2 comments
Closed

Wrong assigment is not flagged by compiler #19820

dbaeumer opened this issue Nov 7, 2017 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@dbaeumer
Copy link
Member

dbaeumer commented Nov 7, 2017

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.
@ahejlsberg
Copy link
Member

It's an error in --strictFunctionTypes mode. See #18654.

@ahejlsberg ahejlsberg added the Working as Intended The behavior described is the intended behavior; this is not a bug label Nov 7, 2017
@dbaeumer
Copy link
Member Author

dbaeumer commented Nov 8, 2017

Thanks. Closing then.

@dbaeumer dbaeumer closed this as completed Nov 8, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants