Home > widget-integration > Guard

Guard type

Type guard function for runtime type checking.

Used throughout the filter module to safely validate data structures from API responses or configuration.

Signature:

export type Guard<T> = (value: unknown) => value is T;

Example

const isSimpleFilterValue: Guard<SimpleFilterValue> = (value): value is SimpleFilterValue => {
  return typeof value === 'object' && 'key' in value && 'label' in value;
};