type Primitive = string | number | boolean | null | Date | undefined; type InputObject = Record>; type ComparisonCondition = { $eq?: T; $ne?: T; $gt?: T; $gte?: T; $lt?: T; $lte?: T; }; type StringCondition = { $contains?: string; $startsWith?: string; $endsWith?: string; $regex?: string; }; type ArrayCondition = { $in?: T[]; $nin?: T[]; }; type MetaCondition = { $exists?: boolean; $type?: "string" | "number" | "boolean" | "object"; }; type FieldCondition = ComparisonCondition & StringCondition & ArrayCondition & MetaCondition; type FieldQuery = { [K in keyof T]?: T[K] extends Primitive ? T[K] | FieldCondition : T[K] extends Primitive[] ? T[K] | ArrayCondition : T[K] extends Record ? NestedFieldQuery | Query : never; }; /** Allows dot-notation-style conditions on nested object fields */ type NestedFieldQuery> = { [K in keyof T]?: T[K] | FieldCondition; }; type LogicalQuery = { $and?: Query[]; $or?: Query[]; $nor?: Query[]; $not?: Query; }; type Query = FieldQuery & LogicalQuery; declare function matchesQuery(input: T, query: Query): boolean; export type { Primitive, InputObject, FieldCondition, Query }; export { matchesQuery };