Skip to content

Conversation

@dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Sep 10, 2021

Fixes #1960 by special-casing compilation of ternary ifs where contextual type is void, dropping each arm evaluating to a concrete value, including ignoring type mismatch if not relevant.

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@MaxGraey
Copy link
Member

MaxGraey commented Sep 10, 2021

could you also add this test?

function boo(): void {}
function foo(fn: () => void): void {
  fn();
}
foo(() => boo()); // allow return void

@dcodeIO
Copy link
Member Author

dcodeIO commented Sep 10, 2021

Seems like a separate issue that is rather related to return. Does the code snippet work right now?

@MaxGraey
Copy link
Member

Does the code snippet work right now?

no Currently it broke compiler

@dcodeIO
Copy link
Member Author

dcodeIO commented Sep 10, 2021

Wasn't there an issue somewhere about that, hmm...

@MaxGraey
Copy link
Member

not sure but I can create

@dcodeIO
Copy link
Member Author

dcodeIO commented Sep 10, 2021

I think there was, but can't find it rn. And yeah, a new one seems good :)

@dcodeIO dcodeIO merged commit c23059a into main Sep 10, 2021
@dcodeIO dcodeIO deleted the issue-1960 branch September 14, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Type 'void' is not assignable to type 'void' although not returning the expression

3 participants