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

🐛 Bug: Added type should be Promise<boolean> not Promise<boolean> | boolean #1494

Open
3 tasks done
rubiesonthesky opened this issue Mar 31, 2024 · 0 comments
Open
3 tasks done
Labels
area: fixers Around how TypeStat fixes code. status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@rubiesonthesky
Copy link
Collaborator

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

This function is not missing return types

	function navigateByUrl(url: string): Promise<boolean>;

	async function navigateTo(): Promise<boolean> {
		return await navigateByUrl("");
	}

Actual

However, it's "fixed" into this

       function navigateByUrl(url: string): Promise<boolean>;

	async function navigateTo(): Promise<boolean> | boolean {
		return await navigateByUrl("");
	}

Additional Info

See discussion https://github.com/JoshuaKGoldberg/TypeStat/pull/1481/files#r1545469119

tsconfig.json

{
	"files": ["actual.ts"]
}

typestat.json

{
	"fixes": {
		"incompleteTypes": true
	},
	"types": {
		"strictNullChecks": true
	}
}

The problem seems to lie when using await or other promise kinds. If function is marked as async, it would be safer to put all types inside Promise.

@rubiesonthesky rubiesonthesky added type: bug Something isn't working :( 🐛 status: accepting prs Please, send a pull request to resolve this! 🙏 area: fixers Around how TypeStat fixes code. labels Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: fixers Around how TypeStat fixes code. status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛
Projects
None yet
Development

No branches or pull requests

1 participant