Skip to main content

negateRuleGroup()

negateRuleGroup<RG extends RuleGroupType<RuleType<string, string, any, string, Record<string, any>>, string>>(rg: RG): RG

Defined in: packages/core/src/utils/formatQuery/negation.ts:66

Applies De Morgan's laws to produce the logical negation of a standard rule group (ignoring the group's own not flag): flips the combinator (and↔or), negates each rule via negateOperator, and toggles not on each child group (processors push down recursively). Rules that can't be negated are dropped. Groups with a combinator other than and/or (e.g. xor) yield an empty group.

Convert independent-combinator queries with convertFromIC first.

Note: missing-field semantics may differ between e.g. $ne and NOT($eq) in some databases.

Type Parameters​

Type Parameter
RG extends RuleGroupType<RuleType<string, string, any, string, Record<string, any>>, string>

Parameters​

ParameterType
rgRG

Returns​

RG


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.