-
Notifications
You must be signed in to change notification settings - Fork 41
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
Return type duplicate infinite amount: | boolean #1447
Comments
@all-contributors please add @rubiesonthesky for bug.
|
I've put up a pull request to add @rubiesonthesky! 🎉 I couldn't determine any contributions to add, did you specify any contributions? |
Adds @rubiesonthesky as a contributor for bug. This was requested by JoshuaKGoldberg [in this comment](#1447 (comment)) --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
This problem comes from react type fixes! I did two changes that fix this problem. In Then, in I think it would be better default option to not assume that project uses React, if that is not otherwise gathered. For example, project should have edit: Now I lost it... it was working for a second. 🤯 edit: Yeah, no. That did not help really. But here are some test cases function navigateByUrl(url: string): Promise<boolean>;
// this mutates to infinite "| boolean"
async function navigateTo(): Promise<boolean> {
return await navigateByUrl("");
}
// this mutates to infinite "| boolean"
async function navigateTo2(): Promise<boolean> {
const navigated = await navigateByUrl("");
return navigated;
}
// this stays same
async function returnSame(): Promise<boolean> {
return navigateByUrl("");
}
// this stays same
async function returnPromise(): Promise<string> {
return Promise.resolve("");
} |
…1481) <!-- 👋 Hi, thanks for sending a PR to TypeStat! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #1447 - I think it also fixes #1284 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/TypeStat/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/TypeStat/blob/main/.github/CONTRIBUTING.md) were taken 😹 ## Overview <!-- Description of what is changed and how the code change does that. --> 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. Co-authored-by: rubiesonthesky <rubiesonthesky>
🐛 Bug Report
Actual Behavior
Expected Behavior
There is no need to change this the return type. This is async function and
Promise<boolean>
should cover that. But also, it should not addboolean
infinite amount to return types union.Reproduction
Original code
I cloned this repo and added this test case to
test/cases/fixes/incompleteTypes/returnTypes/original.ts
file, and I can see same behavior there.After using command
yarn run test:mutation --accept
, I see this inexcepted.ts
andactual.ts
:The text was updated successfully, but these errors were encountered: