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 suggestion: flag optional chain after a non-null assertion #1397

Closed
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginhas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@bradzacher

Description

@bradzacher

Preceding an optional chain with a non-null assertion is useless.

The entire point of the optional chain is that it handles the non-null case.
The non-null assertion doesn't actually change the type, and is functionally useless.

functionfoo(x?:{a:string}){returnx!?.a;}

Thinking about it, this could potentially live as an option withinno-extra-non-null-assertion, but I'm not sure if it entirely fits in there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: new plugin ruleNew rule request for eslint-pluginhas prthere is a PR raised to close thispackage: 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