Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ajafff opened this issue Nov 22, 2017 · 0 comments
Labels
API Relates to the public API for TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@ajafff
Copy link
Contributor

ajafff commented Nov 22, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants