/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Bytes, Duration, UnexpectedDataError } from "@matter/general";
export declare class UnsupportedCastError extends UnexpectedDataError {
}
/**
 * General groupings of Matter types.
 */
export declare enum Metatype {
    any = "any",
    boolean = "boolean",
    bitmap = "bitmap",
    enum = "enum",
    integer = "integer",
    float = "float",
    bytes = "bytes",
    array = "array",
    object = "object",
    string = "string",
    date = "date",
    duration = "duration"
}
export declare namespace Metatype {
    /**
     * Does the specific type have children?
     */
    export function hasChildren(type: Metatype | undefined): boolean;
    /**
     * Determine the JS type for a metatype.
     */
    export function native(type: Metatype | undefined): ArrayConstructor | BigIntConstructor | BooleanConstructor | DateConstructor | NumberConstructor | ObjectConstructor | StringConstructor | Uint8ArrayConstructor | typeof Duration | undefined;
    /**
     * Map metatype value to JS type.
     */
    export type Native<T> = T extends "boolean" ? boolean : T extends "integer" | "float" ? number : T extends "string" ? string : T extends "bitmap" | "object" ? Record<string, unknown> : T extends "array" ? unknown[] : T extends "bytes" ? Uint8Array : T extends "date" ? Date : T extends "any" ? unknown : never;
    /**
     * Functions that perform conversion of arbitrary values to a metatype.
     *
     * This is a "best effort" that ensures the value is an appropriate JS type but cannot ensure semantic validity in
     * all cases.
     *
     * @throws {@link UnsupportedCastError} if the cast is deemed impossible
     */
    export function cast<const T extends `${Metatype}`>(type: T, value: unknown): Native<T>;
    export declare namespace cast {
        var any: (value: unknown) => unknown;
    }
    export declare namespace cast {
        var boolean: (value: unknown) => boolean | null | undefined;
    }
    export declare namespace cast {
        var bitmap: (value: any) => number | bigint | Record<string, number> | null | undefined;
    }
    export declare namespace cast {
        var _a: (value: any) => number | string | null | undefined;
        export { _a as enum };
    }
    export declare namespace cast {
        var integer: (value: any) => number | bigint | null | undefined;
    }
    export declare namespace cast {
        var float: (value: any) => number | null | undefined;
    }
    export declare namespace cast {
        var bytes: (value: any) => Bytes | null | undefined;
    }
    export declare namespace cast {
        var array: (value: any) => Array<unknown> | null | undefined;
    }
    export declare namespace cast {
        var object: (value: any) => Record<string, unknown> | null | undefined;
    }
    export declare namespace cast {
        var string: (value: any) => string | null | undefined;
    }
    export declare namespace cast {
        var date: (value: any) => Date | null | undefined;
    }
    export declare namespace cast {
        var duration: (value: any) => Duration | null | undefined;
    }
    /**
     * These are the native types used by this module.
     */
    export type NativeType = typeof Boolean | typeof BigInt | typeof Number | typeof Bytes | typeof Array | typeof Object | typeof String | typeof Date;
}
//# sourceMappingURL=Metatype.d.ts.map