src/lib/form/detectors/detector.interface.ts

Total Symbols
2
Lines of Code
33
Avg Complexity
1.0
Symbol Types
2

Symbols by Kind

interface 1
method 1

All Symbols

Name Kind Visibility Status Lines Signature
Detector interface exported- 26-32 interface Detector
detect method - 31-31 detect(input: TInput): : TResult

Full Source

/**
 * Detector Interface
 *
 * Base contract shared by every detector in this module.
 *
 *   TInput  — what the detector receives as input.
 *             Use `void` for page-level scanners that operate on the global document.
 *   TResult — what the detector returns.
 *
 * All detectors expose the same two members:
 *
 *   name    — unique, human-readable identifier (used for logging and pipeline ordering)
 *   detect  — the detection function
 *
 * Examples of concrete implementations:
 *
 *   htmlTypeDetector   : Detector<HTMLElement, BasicTypeResult>
 *   labelDetector      : Detector<HTMLElement, LabelResult | undefined>
 *   signalsBuilder     : Detector<Partial<FormField>, string>
 *   selectorBuilder    : Detector<Element, string>
 *   FieldClassifier    : Detector<FormField, ClassifierResult | null>   (sub-interface)
 *   interactiveFieldDetector : Detector<void, InteractiveField[]>
 *   customSelectDetector     : Detector<void, CustomSelectField[]>
 */

export interface Detector<TInput, TResult> {
  /** Unique identifier for this detector. */
  readonly name: string;

  /** Run the detection logic and return the result. */
  detect(input: TInput): TResult;
}