Skip to content

Conversation

ExE-Boss
Copy link
Contributor

This makes it so that for fallback types (e.g. boolean and number), if it’s the last fallback type among overloads or in a union, then the conversion will no longer be duplicated in the if‑and‑else branches:

-} else if (typeof curArg === \\"boolean\\") {
-	{
-		let curArg = arguments[0];
-		curArg = conversions[\\"boolean\\"](curArg, {
-			context: \\"Failed to execute 'overloadsObjectOrBoolean' on 'NoUselessIfElse': parameter 1\\"
-		});
-		args.push(curArg);
-	}
 } else {
 	{
 		let curArg = arguments[0];
 		curArg = conversions[\\"boolean\\"](curArg, {
 			context: \\"Failed to execute 'overloadsObjectOrBoolean' on 'NoUselessIfElse': parameter 1\\"
 		});
 		args.push(curArg);
 	}
 }

Depends on:

@TimothyGu
Copy link
Member

I'd rather not do this, since it makes the code harder to maintain by diverging from the overload resolution algorithm in the spec.

@TimothyGu TimothyGu closed this Jan 3, 2021
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.

2 participants