From 651c61f3c9bba38e34b2a5be719bbaa9a32a0f92 Mon Sep 17 00:00:00 2001 From: Simon Hofmann Date: Tue, 17 Jan 2023 09:31:32 +0100 Subject: [PATCH] Updated docstrings --- lib/query.class.ts | 34 ++++++++++++++++++++++++++++++++-- lib/screen.class.ts | 2 +- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lib/query.class.ts b/lib/query.class.ts index aa5c994..0cc6a19 100644 --- a/lib/query.class.ts +++ b/lib/query.class.ts @@ -23,22 +23,52 @@ type Query = export type TextQuery = Extract; -export type WordQuery = Extract; -export type LineQuery = Extract; +/** + * A word query is a text query that searches for a single word on screen. + * It will be processed by an {@link TextFinderInterface} instance. + */ +export type WordQuery = Extract; +/** + * A word query is a text query that searches for a single text line on screen. + * It will be processed by an {@link TextFinderInterface} instance. + */ +export type LineQuery = Extract; + +/** + * A window query is a query that searches for a window on screen. + * It will be processed by an {@link WindowFinderInterface} instance. + */ export type WindowQuery = Extract; +/** + * Type guard for {@link WordQuery} + * @param possibleQuery A possible word query + */ export const isWordQuery = (possibleQuery: any): possibleQuery is WordQuery => { return possibleQuery?.type === "text" && possibleQuery?.by?.word != null; }; + +/** + * Type guard for {@link LineQuery} + * @param possibleQuery A possible line query + */ export const isLineQuery = (possibleQuery: any): possibleQuery is LineQuery => { return possibleQuery?.type === "text" && possibleQuery?.by?.line != null; }; +/** + * Type guard for {@link TextQuery} + * @param possibleQuery A possible line or word query + */ export const isTextQuery = (possibleQuery: any): possibleQuery is TextQuery => { return possibleQuery?.type === "text"; }; +/** + * Type guard for {@link WindowQuery} + * @param possibleQuery A possible window query + */ export const isWindowQuery = ( possibleQuery: any ): possibleQuery is WindowQuery => { diff --git a/lib/screen.class.ts b/lib/screen.class.ts index 063f0b3..b9c0920 100644 --- a/lib/screen.class.ts +++ b/lib/screen.class.ts @@ -415,7 +415,7 @@ export class ScreenClass { * @param searchInput Filename of the template image, relative to {@link ScreenClass.config.resourceDirectory}, or an {@link Image} * @param timeoutMs Timeout in milliseconds after which {@link waitFor} fails * @param updateInterval Update interval in milliseconds to retry search - * @param params {@link LocationParameters} which are used to fine tune search region and / or match confidence + * @param params {@link OptionalSearchParameters} which are used to fine tune search region and / or match confidence */ public async waitFor( searchInput: RegionResultFindInput | Promise,