UNPKG

@finos/legend-shared

Version:
46 lines 3.18 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { EnrichedError } from './ErrorUtils.js'; import type { GenericClazz, PlainObject } from '../CommonUtils.js'; export declare class AssertionError extends EnrichedError { constructor(error: string | Error | undefined, message?: string); } export declare const isNullable: <T>(value: T | null | undefined) => value is null | undefined; export declare const isNonNullable: <T>(value: T | null | undefined) => value is T; export declare function assertNonNullable<T>(value: T | null | undefined, message?: string): asserts value is T; export declare const guaranteeNonNullable: <T>(value: T | null | undefined, message?: string) => T; export declare const isType: <T>(value: unknown, clazz: GenericClazz<T>) => value is T; export declare const filterByType: <T>(clazz: GenericClazz<T>) => ((value: unknown) => value is T); export declare function assertType<T>(value: unknown, clazz: GenericClazz<T>, message?: string): asserts value is T; export declare const guaranteeType: <T>(value: unknown, clazz: GenericClazz<T>, message?: string) => T; export declare function isNonEmptyString(str: string | null | undefined): str is string; export declare function assertNonEmptyString(str: string | null | undefined, message?: string): asserts str is string; export declare function guaranteeNonEmptyString(str: string | null | undefined, message?: string): string; export declare function assertTrue(assertionValue: boolean, message?: string): asserts assertionValue is true; export declare const isString: (val: unknown) => val is string; export declare const isNumber: (val: unknown) => val is number; export declare const isBoolean: (val: unknown) => val is boolean; export declare const isObject: (val: unknown) => val is object; export declare const isPlainObject: (val: unknown) => val is PlainObject; export declare function assertIsString(val: unknown, message?: string): asserts val is string; export declare function assertIsNumber(val: unknown, message?: string): asserts val is number; export declare function assertIsBoolean(val: unknown, message?: string): asserts val is boolean; export declare function assertIsObject(val: unknown, message?: string): asserts val is object; export declare const guaranteeIsString: (val: unknown, message?: string) => string; export declare const guaranteeIsNumber: (val: unknown, message?: string) => number; export declare const guaranteeIsBoolean: (val: unknown, message?: string) => boolean; export declare const guaranteeIsObject: (val: unknown, message?: string) => object; //# sourceMappingURL=AssertionUtils.d.ts.map