/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Bytes, Duration, UnexpectedDataError } from "#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?
     */
    function hasChildren(type: Metatype | undefined): boolean;
    /**
     * Determine the JS type for a metatype.
     */
    function native(type: Metatype | undefined): ObjectConstructor | ArrayConstructor | StringConstructor | BooleanConstructor | BigIntConstructor | NumberConstructor | Uint8ArrayConstructor | DateConstructor | typeof Duration | undefined;
    /**
     * Map metatype value to JS type.
     */
    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
     */
    function cast<const T extends `${Metatype}`>(type: T, value: unknown): Native<T>;
    namespace cast {
        export var any: (value: unknown) => unknown;
        export var boolean: (value: unknown) => boolean | null | undefined;
        export var bitmap: (value: any) => number | bigint | Record<string, number> | null | undefined;
        var _a: (value: any) => number | string | null | undefined;
        export var integer: (value: any) => number | bigint | null | undefined;
        export var float: (value: any) => number | null | undefined;
        export var bytes: (value: any) => Bytes | null | undefined;
        export var array: (value: any) => Array<unknown> | null | undefined;
        export var object: (value: any) => Record<string, unknown> | null | undefined;
        export var string: (value: any) => string | null | undefined;
        export var date: (value: any) => Date | null | undefined;
        export var duration: (value: any) => Duration | null | undefined;
        export { _a as enum };
    }
    /**
     * These are the native types used by this module.
     */
    type NativeType = typeof Boolean | typeof BigInt | typeof Number | typeof Bytes | typeof Array | typeof Object | typeof String | typeof Date;
}
//# sourceMappingURL=Metatype.d.ts.map