/** * @packageDocumentation * Shared helpers for parsing and flattening nullish comparison expressions. */ import { type TSESTree } from "@typescript-eslint/utils"; /** * Normalized representation of one binary comparison against null/undefined. */ export type NullishComparison = Readonly<{ comparedExpression: TSESTree.Expression; kind: NullishComparisonKind; operator: NullishComparisonOperator; }>; /** Nullish literal kinds supported by comparison extraction. */ export type NullishComparisonKind = "null" | "undefined"; /** Operators supported by nullish comparison extraction. */ export type NullishComparisonOperator = "!=" | "!==" | "==" | "==="; /** * Flatten a logical-expression tree for one specific operator. * * @param options - Expression and logical operator to flatten. * * @returns Left-to-right list of terms participating in that operator chain. */ export declare const flattenLogicalTerms: ({ expression, operator, }: Readonly<{ expression: Readonly; operator: "&&" | "||"; }>) => readonly TSESTree.Expression[]; /** * Narrow a list of expressions to an exact two-term tuple. */ export declare const isExpressionPair: (terms: readonly Readonly[]) => terms is readonly [TSESTree.Expression, TSESTree.Expression]; /** * Extract a normalized nullish comparison from an expression. */ export declare const getNullishComparison: ({ allowedOperators, allowTypeofComparedIdentifierForUndefined, comparedIdentifierName, expression, isGlobalUndefinedIdentifier, }: Readonly<{ allowedOperators?: readonly NullishComparisonOperator[]; allowTypeofComparedIdentifierForUndefined?: boolean; comparedIdentifierName?: string; expression: Readonly; isGlobalUndefinedIdentifier: (expression: Readonly) => boolean; }>) => null | NullishComparison; //# sourceMappingURL=nullish-comparison.d.ts.map