From 89de099c2edeba32432788981bf5e6f430701786 Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Fri, 8 Sep 2023 06:01:38 +0300 Subject: [PATCH] types(vest): add more method overloads to `SuiteSelectors` type --- .../src/suiteResult/selectors/suiteSelectors.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/vest/src/suiteResult/selectors/suiteSelectors.ts b/packages/vest/src/suiteResult/selectors/suiteSelectors.ts index dfc8585b9..8e6a082a5 100644 --- a/packages/vest/src/suiteResult/selectors/suiteSelectors.ts +++ b/packages/vest/src/suiteResult/selectors/suiteSelectors.ts @@ -140,6 +140,8 @@ export function suiteSelectors( return getFailures(summary, Severity.WARNINGS, fieldName); } + function getWarning(): Maybe>; + function getWarning(fieldName: F): Maybe; function getWarning(fieldName?: F): GetSingularResponse { return getFailure(Severity.WARNINGS, summary, fieldName as F); } @@ -150,6 +152,8 @@ export function suiteSelectors( return getFailures(summary, Severity.ERRORS, fieldName); } + function getError(): Maybe>; + function getError(fieldName: F): Maybe; function getError(fieldName?: F): GetSingularResponse { return getFailure(Severity.ERRORS, summary, fieldName as F); } @@ -177,16 +181,24 @@ export function suiteSelectors( } export interface SuiteSelectors { + getWarning(): Maybe>; + getWarning(fieldName: F): Maybe; getWarning(fieldName?: F): GetSingularResponse; + getError(): Maybe>; + getError(fieldName: F): Maybe; getError(fieldName?: F): GetSingularResponse; - getErrors(fieldName: F): string[]; getErrors(): FailureMessages; + getErrors(fieldName: F): string[]; + getErrors(fieldName?: F): string[] | FailureMessages; getWarnings(): FailureMessages; getWarnings(fieldName: F): string[]; - getErrorsByGroup(groupName: G, fieldName: F): string[]; + getWarnings(fieldName?: F): string[] | FailureMessages; getErrorsByGroup(groupName: G): FailureMessages; + getErrorsByGroup(groupName: G, fieldName: F): string[]; + getErrorsByGroup(groupName: G, fieldName?: F): string[] | FailureMessages; getWarningsByGroup(groupName: G): FailureMessages; getWarningsByGroup(groupName: G, fieldName: F): string[]; + getWarningsByGroup(groupName: G, fieldName?: F): string[] | FailureMessages; hasErrors(fieldName?: F): boolean; hasWarnings(fieldName?: F): boolean; hasErrorsByGroup(groupName: G, fieldName?: F): boolean;