diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 3fac4070a0cb..9a9b836bcc92 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -622,13 +622,9 @@ export default createRule({ if (prevType.isUnion()) { const isOwnNullable = prevType.types.some(type => { const signatures = type.getCallSignatures(); - return signatures.some(sig => - isNullableType(sig.getReturnType(), { allowUndefined: true }), - ); + return signatures.some(sig => isNullableType(sig.getReturnType())); }); - return ( - !isOwnNullable && isNullableType(prevType, { allowUndefined: true }) - ); + return !isOwnNullable && isNullableType(prevType); } return false; diff --git a/packages/type-utils/src/predicates.ts b/packages/type-utils/src/predicates.ts index 26ef59355781..f5b01022237e 100644 --- a/packages/type-utils/src/predicates.ts +++ b/packages/type-utils/src/predicates.ts @@ -6,24 +6,10 @@ import { isTypeFlagSet } from './typeFlagUtils'; const log = debug('typescript-eslint:eslint-plugin:utils:types'); -export interface IsNullableTypeOptions { - /** - * @deprecated - this flag no longer does anything and will be removed in the next major - */ - isReceiver?: boolean; - /** - * @deprecated - this flag no longer does anything and will be removed in the next major - */ - allowUndefined?: boolean; -} - /** * Checks if the given type is (or accepts) nullable */ -export function isNullableType( - type: ts.Type, - _deprecated?: IsNullableTypeOptions, -): boolean { +export function isNullableType(type: ts.Type): boolean { return isTypeFlagSet( type, ts.TypeFlags.Any |