-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Description
From what I understand, T | unknown
and T | any
resolve to just unknown
and any
respectively, so I don't think they're particularly useful.
However maybe it's still useful as suggested type documentation, because such types would still appear as X | unknown
in some cases.
Thoughts?
Fail
type MaybeNumber = number | unknown;
function isNumber(value: number | any): value is number {
return typeof value === 'number';
}
Pass
type MaybeNumber = unknown;
function isNumber(value: any): value is number {
return typeof value === 'number';
}
sindresorhus and JoshuaKGoldberg
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin