AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

IQueryFilter.Filter Signature Is Narrower Than Class And Filter Type In Pg-Meta

The IQueryFilter interface in packages/pg-meta/src/query/QueryFilter.ts declares filter(column: string, operator: FilterOperator, value: string), but the implementing QueryFilter class accepts column: string | string[] and value: any. This mismatch creates a latent type trap for consumers that type the receiver as IQueryFilter, blocking valid calls that pass an array column or non-string value even though the class and Filter type support them.

mediumConfidence 97%TypeScript

Origin Analysis

The interface declaration was not updated when the QueryFilter.filter method and the underlying Filter type were widened to support string | string[] columns and any value types.
1. Import IQueryFilter from pg-meta. 2. Declare a variable: const q: IQueryFilter = new QueryFilter(); 3. Attempt: q.filter('id', 'in', [1, 2, 3]); 4. TypeScript error: Argument of type 'number[]' is not assignable to parameter of type 'string'. 5. Alternatively, attempt: q.filter(['id', 'name'], 'eq', 'value'); 6. TypeScript error: Argument of type 'string[]' is not assignable to parameter of type 'string'. The class accepts both calls without issue, so the interface is unsound.

Fixing Code Block

filter: (column: string | string[], operator: FilterOperator, value: any) => IQueryFilter
Widen the interface's filter parameter types to align with the class implementation and the Filter type. This change is contravariantly safe because every caller that satisfied the old signature still satisfies the new one, making the fix non-breaking.

Edge Case Audit

No runtime risk because the change only affects compile-time types. The widening is backward-compatible; no code that previously compiled will break. If a rollback is ever needed, simply revert to the original signature, but that would reintroduce the type mismatch. Ensure any future changes to the class or Filter type are mirrored in the interface.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state