refactor: Implement empty canHandle on base class. (#289)

This commit is contained in:
Ruben Verborgh
2020-10-30 17:56:39 +01:00
committed by GitHub
parent ac8423d28d
commit 1a45b65df7
19 changed files with 23 additions and 46 deletions

View File

@@ -9,7 +9,10 @@ export abstract class AsyncHandler<TInput, TOutput = void> {
*
* @returns A promise resolving if this input can be handled, rejecting with an Error if not.
*/
public abstract canHandle(input: TInput): Promise<void>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async canHandle(input: TInput): Promise<void> {
// Support any input by default
}
/**
* Handles the given input. This should only be done if the {@link canHandle} function returned `true`.