UNPKG

2.28 kBTypeScriptView Raw
1import { TypeCode } from '../convert/TypeCode';
2/**
3 * Helper class matches value types for equality.
4 *
5 * This class has symmetric implementation across all languages supported
6 * by Pip.Services toolkit and used to support dynamic data processing.
7 *
8 * @see [[TypeCode]]
9 */
10export declare class TypeMatcher {
11 /**
12 * Matches expected type to a type of a value.
13 * The expected type can be specified by a type, type name or [[TypeCode]].
14 *
15 * @param expectedType an expected type to match.
16 * @param actualValue a value to match its type to the expected one.
17 * @returns true if types are matching and false if they don't.
18 *
19 * @see [[matchType]]
20 * @see [[matchValueTypeByName]] (for matching by types' string names)
21 */
22 static matchValueType(expectedType: any, actualValue: any): boolean;
23 /**
24 * Matches expected type to an actual type.
25 * The types can be specified as types, type names or [[TypeCode]].
26 *
27 * @param expectedType an expected type to match.
28 * @param actualType an actual type to match.
29 * @param actualValue an optional value to match its type to the expected one.
30 * @returns true if types are matching and false if they don't.
31 *
32 * @see [[matchTypeByName]]
33 * @see [[matchTypeByName]] (for matching by types' string names)
34 */
35 static matchType(expectedType: any, actualType: TypeCode, actualValue?: any): boolean;
36 /**
37 * Matches expected type to a type of a value.
38 *
39 * @param expectedType an expected type name to match.
40 * @param actualValue a value to match its type to the expected one.
41 * @returns true if types are matching and false if they don't.
42 */
43 static matchValueTypeByName(expectedType: string, actualValue: any): boolean;
44 /**
45 * Matches expected type to an actual type.
46 *
47 * @param expectedType an expected type name to match.
48 * @param actualType an actual type to match defined by type code.
49 * @param actualValue an optional value to match its type to the expected one.
50 * @returns true if types are matching and false if they don't.
51 */
52 static matchTypeByName(expectedType: string, actualType: TypeCode, actualValue?: any): boolean;
53}