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 as not planned
Closed as not planned
Labels
bugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a lookworking as intendedIssues that are closed as they are working as intended
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
// From https://github.com/sindresorhus/type-fest/blob/HEAD/source/set-non-nullable.d.tsexporttypeSetNonNullable<BaseType,KeysextendskeyofBaseType=keyofBaseType>={[KeyinkeyofBaseType]:KeyextendsKeys ?NonNullable<BaseType[Key]> :BaseType[Key];};exportconstnonNullish=<T>(value:T|null|undefined):value isT=>value!=null;exportconsthasNonNullishField=<T,KextendskeyofT>(obj:T,key:K,):obj isSetNonNullable<T,K>=>nonNullish(obj[key]);// <--
ESLint Config
{"rules":{"@typescript-eslint/no-unnecessary-condition":["error",{"checkTypePredicates":true}]}}
tsconfig
{"compilerOptions": {// ... }}
Expected Result
The type ofobj[key]
in the example can be nullish and therefore the error should not be reported.
Actual Result
The error is reported.
Additional Info
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a lookworking as intendedIssues that are closed as they are working as intended