Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
typeNode={[namein `${Uppercase<string>}${string}`]?:Node;}&{[namein `${Lowercase<string>}${string}`]?:string;};exportfunctiontest(root:Node){// Unnecessary optional chain on a non-nullish valueconsole.log(root.Foo?.Bar?.baz);// 'root.Foo.Bar' is possibly 'undefined'console.log(root.Foo?.Bar.baz);}
ESLint Config
{"rules":{"@typescript-eslint/no-unnecessary-condition":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
I expect the optional chaining to be allowed on line 9.
Actual Result
A lint error is emitted on line 9
Additional Info
The playground contains some more code, showing cases where things work and where things don't.
This issue is likely related to#9754