Skip to content

Feature Request: add TypeChecker API to query if identifier is definitely assigned #20221

@ajafff

Description

@ajafff

Currently it's not possible to query CFA. I need to find out if an identifier is definitely assigned. This logic is part of checkIdentifier and is not accessible outside of that function.

My use case is the TSLint rule no-unnecessary-type-assertion where we need to identify false positives. The current implementation compares the type before and after the non-null-assertion. That doesn't work well for identifiers that are not definitely assigned, because the assertion suppresses TS2454 and can therefore not be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIRelates to the public API for TypeScriptIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy