/**
 * @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;
    /**
     * Shape of {@link cast}: a generic call signature for dispatch + per-metatype converters.
     */
    interface Cast {
        <const T extends `${Metatype}`>(type: T, value: unknown): Native<T>;
        any: (value: unknown) => unknown;
        boolean: (value: unknown) => boolean | null | undefined;
        bitmap: (value: any) => number | bigint | Record<string, number> | null | undefined;
        enum: (value: any) => number | string | null | undefined;
        integer: (value: any) => number | bigint | null | undefined;
        float: (value: any) => number | null | undefined;
        bytes: (value: any) => Bytes | null | undefined;
        array: (value: any) => Array<unknown> | null | undefined;
        object: (value: any) => Record<string, unknown> | null | undefined;
        string: (value: any) => string | null | undefined;
        date: (value: any) => Date | null | undefined;
        duration: (value: any) => Duration | null | undefined;
    }
    /**
     * 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 const cast: Cast;
    /**
     * 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;
    export {};
}
//# sourceMappingURL=Metatype.d.ts.map