@@ -23,22 +23,52 @@ type Query =
23
23
24
24
export type TextQuery = Extract < Query , { type : "text" } > ;
25
25
26
- export type WordQuery = Extract < TextQuery , { by : { word : string | RegExp } } > ;
27
- export type LineQuery = Extract < TextQuery , { by : { line : string | RegExp } } > ;
26
+ /**
27
+ * A word query is a text query that searches for a single word on screen.
28
+ * It will be processed by an {@link TextFinderInterface} instance.
29
+ */
30
+ export type WordQuery = Extract < TextQuery , { by : { word : string } } > ;
28
31
32
+ /**
33
+ * A word query is a text query that searches for a single text line on screen.
34
+ * It will be processed by an {@link TextFinderInterface} instance.
35
+ */
36
+ export type LineQuery = Extract < TextQuery , { by : { line : string } } > ;
37
+
38
+ /**
39
+ * A window query is a query that searches for a window on screen.
40
+ * It will be processed by an {@link WindowFinderInterface} instance.
41
+ */
29
42
export type WindowQuery = Extract < Query , { type : "window" } > ;
30
43
44
+ /**
45
+ * Type guard for {@link WordQuery}
46
+ * @param possibleQuery A possible word query
47
+ */
31
48
export const isWordQuery = ( possibleQuery : any ) : possibleQuery is WordQuery => {
32
49
return possibleQuery ?. type === "text" && possibleQuery ?. by ?. word != null ;
33
50
} ;
51
+
52
+ /**
53
+ * Type guard for {@link LineQuery}
54
+ * @param possibleQuery A possible line query
55
+ */
34
56
export const isLineQuery = ( possibleQuery : any ) : possibleQuery is LineQuery => {
35
57
return possibleQuery ?. type === "text" && possibleQuery ?. by ?. line != null ;
36
58
} ;
37
59
60
+ /**
61
+ * Type guard for {@link TextQuery}
62
+ * @param possibleQuery A possible line or word query
63
+ */
38
64
export const isTextQuery = ( possibleQuery : any ) : possibleQuery is TextQuery => {
39
65
return possibleQuery ?. type === "text" ;
40
66
} ;
41
67
68
+ /**
69
+ * Type guard for {@link WindowQuery}
70
+ * @param possibleQuery A possible window query
71
+ */
42
72
export const isWindowQuery = (
43
73
possibleQuery : any
44
74
) : possibleQuery is WindowQuery => {
0 commit comments