Closed as not planned
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
function myFunc(arg: null | undefined): undefined {
return arg ?? undefined
}
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unnecessary-condition": [
"error",
{
"allowConstantLoopConditions": true
}
]
},
};
tsconfig
Expected Result
arg ?? undefined
limits the union type null | undefined
to just undefined
so it's not unnecessary.
Actual Result
arg ?? undefined
errors out like if it didn't restrict the union type a subset of its values.
Additional Info
No response