@@ -23,22 +23,52 @@ type Query =
2323
2424export type TextQuery = Extract < Query , { type : "text" } > ;
2525
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 } } > ;
2831
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+ */
2942export type WindowQuery = Extract < Query , { type : "window" } > ;
3043
44+ /**
45+ * Type guard for {@link WordQuery}
46+ * @param possibleQuery A possible word query
47+ */
3148export const isWordQuery = ( possibleQuery : any ) : possibleQuery is WordQuery => {
3249 return possibleQuery ?. type === "text" && possibleQuery ?. by ?. word != null ;
3350} ;
51+
52+ /**
53+ * Type guard for {@link LineQuery}
54+ * @param possibleQuery A possible line query
55+ */
3456export const isLineQuery = ( possibleQuery : any ) : possibleQuery is LineQuery => {
3557 return possibleQuery ?. type === "text" && possibleQuery ?. by ?. line != null ;
3658} ;
3759
60+ /**
61+ * Type guard for {@link TextQuery}
62+ * @param possibleQuery A possible line or word query
63+ */
3864export const isTextQuery = ( possibleQuery : any ) : possibleQuery is TextQuery => {
3965 return possibleQuery ?. type === "text" ;
4066} ;
4167
68+ /**
69+ * Type guard for {@link WindowQuery}
70+ * @param possibleQuery A possible window query
71+ */
4272export const isWindowQuery = (
4373 possibleQuery : any
4474) : possibleQuery is WindowQuery => {
0 commit comments