-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Maybe false positive from TS2801 (Promise<...> appears to always be defined) #45608
Comments
You want to enable |
Unfortunately, due to #10530 if (a['a']) {
a['a'] // Promise<string> | undefined
} And I assume it will be even harder to narrow for index value So, the workaround here is to use if ('a' in a) {
a['a'] // Promise<string>
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
π Search Terms
TS2801
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
This condition will always return true since this 'Promise' is always defined.
π Expected behavior
No error.
The text was updated successfully, but these errors were encountered: