FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Enable @typescript-eslint/ban-types by jakebailey · Pull Request #55133 · microsoft/TypeScript · GitHub

Enable @typescript-eslint/ban-types - #55133

Merged
Jake Bailey (jakebailey) merged 3 commits into
microsoft:mainfrom
jakebailey:eslint-ban-types
Jul 27, 2023
Merged

Enable @typescript-eslint/ban-types#55133
Jake Bailey (jakebailey) merged 3 commits into
microsoft:mainfrom
jakebailey:eslint-ban-types

Conversation

Jake Bailey (jakebailey) commented Jul 24, 2023
edited
Loading

Copy link
Copy Markdown
Member

Follow-up to #54693.

All of the things it catches are harmless, realistically, though I agree that as Function was the wrong cast as that'd let us accidentally new it or something.

I definitely disagree with the default of banning {}; that's a very useful type (especially post #49119, a number I have memorized at this point). Annoyingly, violating the rule that bans {} or Object says to use NonNullable<unknown> which is exactly {}.

The fact that Symbol is mistaken as the global Symbol I believe is a bug in ts-eslint, though I don't think it's reported so I'll do that shortly. typescript-eslint/typescript-eslint#7306

Disabling those two leaves the rule to only ban the uppercase primitive wrapper types (good) and Object (probably good), so it seems like this rule is fine to keep enabled.

Copy link
Copy Markdown

as Function was the wrong cast as that'd let us accidentally new it or something

why isn’t Function treated as a top type similar to (...args: never) => unknown?

Copy link
Copy Markdown
Member Author

as Function was the wrong cast as that'd let us accidentally new it or something

why isn’t Function treated as a top type similar to (...args: never) => unknown?

Presumably exactly for the reason I gave; (...args: never) => unknown can't be new-d but Function can. But, I'm not a total expert on why. I definitely read something about this in the past year but it's hard to find when the only term I can use is "function".

Jake Bailey (jakebailey) merged commit a6df6c0 into microsoft:main Jul 27, 2023
Jake Bailey (jakebailey) deleted the eslint-ban-types branch July 27, 2023 22:58
Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL