-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassValidator.mts
42 lines (38 loc) · 1.16 KB
/
ClassValidator.mts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import type {
ExtensibleObjectValidator,
ClassConstructor
} from "./internal/internal.mjs";
/**
* Validates the requirements of a type.
*
* Verifier and Validator methods are equivalent.
* Validators return validation failures through the
* {@link ExtensibleObjectValidator.getFailures | getFailures()} method, while Verifiers throw them as
* exceptions.
*
* All methods (except those found in {@link ObjectValidator}) assume that the actual value is not null.
*
* @typeParam T - the type of the class
*/
interface ClassValidator<T> extends ExtensibleObjectValidator<ClassValidator<T>, ClassConstructor<T>>
{
/**
* Ensures that the actual value is the specified type, or a subtype.
*
* @param type -the type to compare to
* @returns the updated validator
*/
isSupertypeOf<T2>(type: ClassConstructor<T2>): ClassValidator<T>;
/**
* Ensures that the actual value is the specified type, or a subtype.
*
* @param type -the type to compare to
* @returns the updated validator
*/
isSubtypeOf<T2>(type: ClassConstructor<T2>): ClassValidator<T>;
/**
* {@inheritDoc}
*/
getActual(): ClassConstructor<T> | undefined;
}
export {type ClassValidator};