Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rule proposal: Disallow unions withunknown orany #3926

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@fregante

Description

@fregante

Description

From what I understand,T | unknown andT | any resolve to justunknown andany respectively, so I don't think they're particularly useful.

However maybe it's still useful assuggested type documentation, because such types would still appear asX | unknown in some cases.

Thoughts?

Fail

typeMaybeNumber=number|unknown;functionisNumber(value:number|any):value isnumber{returntypeofvalue==='number';}

Pass

typeMaybeNumber=unknown;functionisNumber(value:any):value isnumber{returntypeofvalue==='number';}

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp