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

fix: No more adding infinite boolean for function returning promise #1481

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

rubiesonthesky
Copy link
Collaborator

@rubiesonthesky rubiesonthesky commented Mar 29, 2024

PR Checklist

Overview

It was this small change in the end??

Note, async function navigateTo(): Promise<boolean> | boolean { and async function navigateTo2(): Promise<boolean> | boolean { are wrong. Both should return only Promise<boolean>. I can remove those from the test but I wanted to keep them to see, the difference.

return await navigateByUrl("");
}

async function navigateTo2(): Promise<boolean> | boolean {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, async function navigateTo(): Promise<boolean> | boolean { and async function navigateTo2(): Promise<boolean> | boolean { are wrong. Both should return only Promise<boolean>. I can remove those from the test but I wanted to keep them to see, the difference.

Yeah that looks like an existing unrelated issue. Up for a followup? 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that looks like an existing unrelated issue. Up for a followup?

Yeah. I think I have now understood that many of the issues that I'm seeing, are coming from the root cause that TypeStat does not understand that it should be adding more types to inside Promise.

@@ -6,6 +6,8 @@ import { setSubtract } from "../../shared/sets.js";
const knownTypeFlagEquivalents = new Map([
[ts.TypeFlags.BigInt, ts.TypeFlags.BigIntLiteral],
[ts.TypeFlags.BigIntLiteral, ts.TypeFlags.BigInt],
[ts.TypeFlags.Boolean, ts.TypeFlags.BooleanLiteral],
[ts.TypeFlags.BooleanLiteral, ts.TypeFlags.Boolean],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was this small change in the end??

😄 a lot of these little bugs are! Nice find though, this is a really good fix.

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bill and Ted going "EXCELLENT!" and air guitaring at each other

@JoshuaKGoldberg JoshuaKGoldberg merged commit 9066333 into main Mar 30, 2024
14 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the fix-infinite-boolean branch March 30, 2024 17:51
@JoshuaKGoldberg
Copy link
Owner

@all-contributors please add @rubiesonthesky for code.

🤖 Beep boop! This comment was added automatically by all-contributors-auto-action.
Not all contributions can be detected from Git & GitHub alone. Please comment any missing contribution types this bot missed.
...and of course, thank you for contributing! 💙

Copy link
Contributor

@JoshuaKGoldberg

@rubiesonthesky already contributed before to code

I couldn't determine any contributions to add, did you specify any contributions?
Please make sure to use valid contribution names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants