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: [no-invalid-void-type] better report message for void used as a constituent inside a function return type #5255

Closed
4 tasks done
Zamiell opened this issue Jun 26, 2022 · 7 comments · Fixed by #5274
Closed
4 tasks done
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@Zamiell
Copy link
Contributor

Zamiell commented Jun 26, 2022

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=4.7.2&sourceType=module&code=CYUwxgNghgTiAEAzArgOzAFwJYHtVJxwAoBKALnlWQFsAjEGeAH3gDcctgBuAWACggA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1uYDcBDRgBNaPDpWFFS6KAHc+0JpHBgAviDVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

@Zamiell Zamiell added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jun 26, 2022
@bradzacher bradzacher added working as intended Issues that are closed as they are working as intended and removed bug Something isn't working triage Waiting for maintainers to take a look labels Jun 26, 2022
@bradzacher
Copy link
Member

That is working as expected.
You should use type | undefined, not | void.
This is the exact thing the rule is seeking to prevent.

Please see the rule docs
https://typescript-eslint.io/rules/no-invalid-void-type/

@bradzacher bradzacher closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2022
@Zamiell
Copy link
Contributor Author

Zamiell commented Jun 26, 2022

Oh, I see. The error message is a little misleading then, maybe we should update it?

@JoshuaKGoldberg
Copy link
Member

Good point - yes, we can special case the error message in the case of a union or intersection type directly used as a function's return type.

@JoshuaKGoldberg JoshuaKGoldberg added enhancement New feature or request good first issue Good for newcomers accepting prs Go ahead, send a pull request that resolves this issue and removed working as intended Issues that are closed as they are working as intended labels Jun 26, 2022
@JoshuaKGoldberg JoshuaKGoldberg changed the title Bug: [no-invalid-void-type] type unions cause false positions Bug: [no-invalid-void-type] better report message for void used as a constituent inside a function return type Jun 26, 2022
@kmin-jeong
Copy link
Contributor

@Zamiell I push pr about this issue! Please check it if what you intended!

@kmin-jeong
Copy link
Contributor

@JoshuaKGoldberg @Zamiell
When I contributed to this issue, I only added the message type part, and the rest of the part was the type boolean, so I didn't touch it. Is it correct that I understood?

@JoshuaKGoldberg
Copy link
Member

Sorry, I don't follow?

@kmin-jeong
Copy link
Contributor

@JoshuaKGoldberg I don't have enough time to solve this , so can I hand it over to someone else?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants