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 | pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy