interface DetailedType {
    type: string;
    constructor: string | null;
    prototype: string | null;
    isPrimitive: boolean;
    isBuiltIn: boolean;
    isNullish: boolean;
    isIterable: boolean;
    isAsync: boolean;
    customType: string | null;
    metadata?: Record<string, any> | undefined;
}
declare function fastKindOf(value: unknown): string;
declare function kindOfMany(values: unknown[]): string[];
declare function getDetailedType(value: unknown): DetailedType;
declare function enableCache(): void;
declare function disableCache(): void;
declare function clearCache(): void;

interface TypeMap {
  'undefined': undefined;
  'null': null;
  'boolean': boolean;
  'number': number;
  'string': string;
  'symbol': symbol;
  'bigint': bigint;
  'object': object;
  'array': any[];
  'function': Function;
  'date': Date;
  'regexp': RegExp;
  'error': Error;
  'promise': Promise<any>;
  'map': Map<any, any>;
  'set': Set<any>;
  'weakmap': WeakMap<any, any>;
  'weakset': WeakSet<any>;
  'int8array': Int8Array;
  'uint8array': Uint8Array;
  'uint8clampedarray': Uint8ClampedArray;
  'int16array': Int16Array;
  'uint16array': Uint16Array;
  'int32array': Int32Array;
  'uint32array': Uint32Array;
  'float32array': Float32Array;
  'float64array': Float64Array;
  'bigint64array': BigInt64Array;
  'biguint64array': BigUint64Array;
  'generatorfunction': GeneratorFunction$1;
  'asyncfunction': AsyncFunction;
  'asyncgeneratorfunction': AsyncGeneratorFunction;
  'proxy': any;
  'dataview': DataView;
  'arraybuffer': ArrayBuffer;
  'sharedarraybuffer': SharedArrayBuffer;
  'arguments': IArguments;
  'buffer': Buffer;
  'stream': NodeJS.ReadableStream | NodeJS.WritableStream;
  'eventemitter': NodeJS.EventEmitter;
  'element': Element;
  'node': Node;
  'window': Window;
  'document': Document;
  'global': typeof globalThis;
}

type TypeName = keyof TypeMap;

type TypeString<T> = 
  T extends undefined ? 'undefined' :
  T extends null ? 'null' :
  T extends boolean ? 'boolean' :
  T extends number ? 'number' :
  T extends string ? 'string' :
  T extends symbol ? 'symbol' :
  T extends bigint ? 'bigint' :
  T extends any[] ? 'array' :
  T extends Function ? 'function' :
  T extends Date ? 'date' :
  T extends RegExp ? 'regexp' :
  T extends Error ? 'error' :
  T extends Promise<any> ? 'promise' :
  T extends Map<any, any> ? 'map' :
  T extends Set<any> ? 'set' :
  T extends WeakMap<any, any> ? 'weakmap' :
  T extends WeakSet<any> ? 'weakset' :
  T extends Int8Array ? 'int8array' :
  T extends Uint8Array ? 'uint8array' :
  T extends Uint8ClampedArray ? 'uint8clampedarray' :
  T extends Int16Array ? 'int16array' :
  T extends Uint16Array ? 'uint16array' :
  T extends Int32Array ? 'int32array' :
  T extends Uint32Array ? 'uint32array' :
  T extends Float32Array ? 'float32array' :
  T extends Float64Array ? 'float64array' :
  T extends BigInt64Array ? 'bigint64array' :
  T extends BigUint64Array ? 'biguint64array' :
  T extends DataView ? 'dataview' :
  T extends ArrayBuffer ? 'arraybuffer' :
  T extends SharedArrayBuffer ? 'sharedarraybuffer' :
  T extends object ? 'object' :
  string;


// Helper types for advanced type checking
type Primitive = undefined | null | boolean | number | string | symbol | bigint;
type Nullish = undefined | null;
type Falsy = false | 0   | 0n | '' | null | undefined;
type TypedArray$1 = 
  | Int8Array 
  | Uint8Array 
  | Uint8ClampedArray 
  | Int16Array 
  | Uint16Array 
  | Int32Array 
  | Uint32Array 
  | Float32Array 
  | Float64Array 
  | BigInt64Array 
  | BigUint64Array;

// Function type helpers
interface GeneratorFunction$1 {
  new(...args: any[]): Generator;
  (...args: any[]): Generator;
}

interface AsyncFunction {
  new(...args: any[]): Promise<any>;
  (...args: any[]): Promise<any>;
}

interface AsyncGeneratorFunction {
  new(...args: any[]): AsyncGenerator;
  (...args: any[]): AsyncGenerator;
}

// Node.js type helpers (will be undefined in browser)
declare global {
  namespace NodeJS {
    interface ReadableStream {}
    interface WritableStream {}
    interface EventEmitter {}
  }
  interface Buffer {}
}

declare function isUndefined(value: unknown): value is undefined;
declare function isNull(value: unknown): value is null;
declare function isBoolean(value: unknown): value is boolean;
declare function isNumber(value: unknown): value is number;
declare function isString(value: unknown): value is string;
declare function isSymbol(value: unknown): value is symbol;
declare function isBigInt(value: unknown): value is bigint;
declare function isPrimitive(value: unknown): value is undefined | null | boolean | number | string | symbol | bigint;
declare function isNullish(value: unknown): value is undefined | null;
declare function isFalsy(value: unknown): value is false | 0 | 0n | '' | null | undefined;
declare function isTruthy<T>(value: T): value is Exclude<T, false | 0 | 0n | '' | null | undefined>;
declare function isInteger(value: unknown): value is number;
declare function isSafeInteger(value: unknown): value is number;
declare function isFinite(value: unknown): value is number;
declare function isNaN(value: unknown): value is number;
declare function isInfinity(value: unknown): value is number;
declare function isEmptyString(value: unknown): value is '';
declare function isNumericString(value: unknown): value is string;
declare function isJsonString(value: unknown): value is string;

declare function isObject(value: unknown): value is object;
declare function isArray<T = unknown>(value: unknown): value is T[];
declare function isFunction(value: unknown): value is (...args: any[]) => any;
declare function isDate(value: unknown): value is Date;
declare function isRegExp(value: unknown): value is RegExp;
declare function isError(value: unknown): value is Error;
declare function isPromise<T = unknown>(value: unknown): value is Promise<T>;
declare function isArguments(value: unknown): value is IArguments;
declare function isBuffer(value: unknown): value is Buffer;
declare function isPlainObject(value: unknown): value is Record<string, unknown>;
declare function isEmpty(value: unknown): boolean;
declare function isEmptyArray(value: unknown): value is [];
declare function isEmptyObject(value: unknown): value is Record<string, never>;
declare function hasLength(value: unknown): value is {
    length: number;
};
declare function hasSize(value: unknown): value is {
    size: number;
};
declare function isArrayLike<T = unknown>(value: unknown): value is ArrayLike<T>;
declare function isIterable<T = unknown>(value: unknown): value is Iterable<T>;
declare function isAsyncIterable<T = unknown>(value: unknown): value is AsyncIterable<T>;
declare function isConstructor(value: unknown): value is new (...args: any[]) => any;
declare function isThenable<T = unknown>(value: unknown): value is PromiseLike<T>;
declare function isObservable(value: unknown): value is {
    subscribe: (...args: any[]) => any;
};
declare function isGenerator(value: unknown): value is Generator;
declare function isAsyncGenerator(value: unknown): value is AsyncGenerator;
declare function isGeneratorFunction(value: unknown): value is GeneratorFunction;
declare function isAsyncFunction(value: unknown): value is (...args: any[]) => Promise<unknown>;
declare function isAsyncGeneratorFunction(value: unknown): value is (...args: any[]) => AsyncGenerator;
declare function isProxy(value: unknown): value is object;
declare function isTypeError(value: unknown): value is TypeError;
declare function isRangeError(value: unknown): value is RangeError;
declare function isSyntaxError(value: unknown): value is SyntaxError;
declare function isReferenceError(value: unknown): value is ReferenceError;
declare function isEvalError(value: unknown): value is EvalError;
declare function isURIError(value: unknown): value is URIError;
declare function isStream(value: unknown): value is NodeJS.ReadableStream | NodeJS.WritableStream;
declare function isEventEmitter(value: unknown): value is NodeJS.EventEmitter;
declare function isElement(value: unknown): value is Element;
declare function isNode(value: unknown): value is Node;
declare function isWindow(value: unknown): value is Window;
declare function isDocument(value: unknown): value is Document;
declare function isGlobal(value: unknown): value is typeof globalThis;

declare function isMap<K = any, V = any>(value: unknown): value is Map<K, V>;
declare function isSet<T = any>(value: unknown): value is Set<T>;
declare function isWeakMap<K extends object = object, V = any>(value: unknown): value is WeakMap<K, V>;
declare function isWeakSet<T extends object = object>(value: unknown): value is WeakSet<T>;
declare function isDataView(value: unknown): value is DataView;
declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
declare function isSharedArrayBuffer(value: unknown): value is SharedArrayBuffer;
declare function isTypedArray(value: unknown): value is TypedArray;
declare function isInt8Array(value: unknown): value is Int8Array;
declare function isUint8Array(value: unknown): value is Uint8Array;
declare function isUint8ClampedArray(value: unknown): value is Uint8ClampedArray;
declare function isInt16Array(value: unknown): value is Int16Array;
declare function isUint16Array(value: unknown): value is Uint16Array;
declare function isInt32Array(value: unknown): value is Int32Array;
declare function isUint32Array(value: unknown): value is Uint32Array;
declare function isFloat32Array(value: unknown): value is Float32Array;
declare function isFloat64Array(value: unknown): value is Float64Array;
declare function isBigInt64Array(value: unknown): value is BigInt64Array;
declare function isBigUint64Array(value: unknown): value is BigUint64Array;
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;

declare function isType<T extends TypeName>(value: unknown, type: T): value is TypeMap[T];
declare function assertType<T extends TypeName>(value: unknown, type: T): asserts value is TypeMap[T];
declare function ensureType<T extends TypeName>(value: unknown, type: T, defaultValue: TypeMap[T]): TypeMap[T];

type SchemaType = string | SchemaObject | SchemaArray;

interface SchemaObject {
  [key: string]: SchemaType;
}

interface SchemaArray extends Array<SchemaType> {}

interface ValidationResult {
  valid: boolean;
  errors: ValidationError[];
  warnings?: ValidationWarning[];
}

interface ValidationError {
  path: string;
  expected: string;
  actual: string;
  message: string;
}

interface ValidationWarning {
  path: string;
  message: string;
}

interface ValidationOptions {
  strict?: boolean;
  coerce?: boolean;
  partial?: boolean;
  path?: string;
}

declare function validateSchema(value: unknown, schema: SchemaType, options?: ValidationOptions): ValidationResult;
declare function createValidator(schema: SchemaType, options?: ValidationOptions): (value: unknown) => ValidationResult;

declare function toString(value: unknown): string;
declare function toNumber(value: unknown): number | null;
declare function toBoolean(value: unknown): boolean;
declare function toBigInt(value: unknown): bigint | null;
declare function toSymbol(value: unknown): symbol;

declare function toArray(value: unknown): unknown[] | null;
declare function toObject(value: unknown): Record<string, unknown> | null;
declare function toMap(value: unknown): Map<unknown, unknown> | null;
declare function toSet(value: unknown): Set<unknown> | null;
declare function toDate(value: unknown): Date | null;
declare function toRegExp(value: unknown): RegExp | null;
declare function toError(value: unknown): Error | null;
declare function toFunction(value: unknown): ((...args: any[]) => any) | null;
declare function toPromise(value: unknown): Promise<unknown> | null;
declare function toBuffer(value: unknown): Buffer | null;
declare function toTypedArray<T extends ArrayBufferView>(value: unknown, TypedArrayConstructor: new (buffer: ArrayBuffer) => T): T | null;

declare function coerceType<T extends TypeName>(value: unknown, targetType: T): TypeMap[T] | null;

interface PerformanceMetrics {
    totalCalls: number;
    totalTime: number;
    averageTime: number;
    minTime: number;
    maxTime: number;
    cacheHits: number;
    cacheMisses: number;
}
declare class PerformanceMonitor {
    private metrics;
    private enabled;
    enable(): void;
    disable(): void;
    isEnabled(): boolean;
    startTimer(operation: string): () => void;
    recordCacheHit(operation: string): void;
    recordCacheMiss(operation: string): void;
    private recordMetric;
    private getOrCreateMetric;
    getMetrics(operation?: string): PerformanceMetrics | Map<string, PerformanceMetrics>;
    reset(operation?: string): void;
    getReport(): string;
}
declare const performanceMonitor: PerformanceMonitor;

interface InspectOptions {
    depth?: number;
    colors?: boolean;
    showHidden?: boolean;
    showProxy?: boolean;
    maxArrayLength?: number;
    maxStringLength?: number;
    breakLength?: number;
    compact?: boolean;
    sorted?: boolean;
    getters?: boolean;
}
declare function inspect(value: unknown, options?: InspectOptions): string;
declare function inspectType(value: unknown): string;

declare function isValidType(type: string): boolean;
declare function getTypeCategory(type: string): string;
declare function compareTypes(a: unknown, b: unknown): boolean;
declare function isTypeOfAny(value: unknown, types: string[]): boolean;
declare function isTypeOfAll(values: unknown[], expectedType: string): boolean;
declare function groupByType(values: unknown[]): Map<string, unknown[]>;
declare function getTypeStats(values: unknown[]): Record<string, number>;
declare function filterByType<T>(values: unknown[], type: string): T[];
declare function findByType(values: unknown[], type: string): unknown;
declare function someOfType(values: unknown[], type: string): boolean;
declare function everyOfType(values: unknown[], type: string): boolean;
declare function noneOfType(values: unknown[], type: string): boolean;
declare function countByType(values: unknown[], type: string): number;
declare function getUniqueTypes(values: unknown[]): string[];
declare function createTypeMap(values: unknown[]): Map<string, unknown[]>;
declare function getMostCommonType(values: unknown[]): string | null;
declare function getLeastCommonType(values: unknown[]): string | null;
declare function isHomogeneous(values: unknown[]): boolean;
declare function isHeterogeneous(values: unknown[]): boolean;
declare function partition(values: unknown[], predicate: (value: unknown) => boolean): [unknown[], unknown[]];
declare function partitionByType(values: unknown[], type: string): [unknown[], unknown[]];

type TypeChecker = (value: unknown) => boolean;
interface TypePlugin {
    name: string;
    version: string;
    types: Record<string, TypeChecker>;
    setup?: (kindOf: KindOfInstance) => void;
    teardown?: () => void;
}
interface KindOfInstance {
    (value: unknown): string;
    use(plugin: TypePlugin): this;
    unuse(pluginName: string): this;
    defineType(name: string, checker: TypeChecker): this;
    removeType(name: string): this;
    getCustomTypes(): Record<string, TypeChecker>;
    hasType(name: string): boolean;
}
interface PluginOptions {
    override?: boolean;
    prefix?: string;
}

declare function createKindOfInstance(): KindOfInstance;
declare function createPlugin(config: TypePlugin): TypePlugin;

declare const reactPlugin: TypePlugin;

declare const nodePlugin: TypePlugin;

declare function kindOf(value: unknown): string;
declare function kindOf<T>(value: T): TypeString<T>;

declare const typeOf: typeof kindOf;
declare const getType: typeof kindOf;

export { PerformanceMonitor, assertType, clearCache, coerceType, compareTypes, countByType, createKindOfInstance, createPlugin, createTypeMap, createValidator, kindOf as default, disableCache, enableCache, ensureType, everyOfType, fastKindOf, filterByType, findByType, getDetailedType, getLeastCommonType, getMostCommonType, getType, getTypeCategory, getTypeStats, getUniqueTypes, groupByType, hasLength, hasSize, inspect, inspectType, isArguments, isArray, isArrayBuffer, isArrayLike, isAsyncFunction, isAsyncGenerator, isAsyncGeneratorFunction, isAsyncIterable, isBigInt, isBigInt64Array, isBigUint64Array, isBoolean, isBuffer, isConstructor, isDataView, isDate, isDocument, isElement, isEmpty, isEmptyArray, isEmptyObject, isEmptyString, isError, isEvalError, isEventEmitter, isFalsy, isFinite, isFloat32Array, isFloat64Array, isFunction, isGenerator, isGeneratorFunction, isGlobal, isHeterogeneous, isHomogeneous, isInfinity, isInt16Array, isInt32Array, isInt8Array, isInteger, isIterable, isJsonString, isMap, isNaN, isNode, isNull, isNullish, isNumber, isNumericString, isObject, isObservable, isPlainObject, isPrimitive, isPromise, isProxy, isRangeError, isReferenceError, isRegExp, isSafeInteger, isSet, isSharedArrayBuffer, isStream, isString, isSymbol, isSyntaxError, isThenable, isTruthy, isType, isTypeError, isTypeOfAll, isTypeOfAny, isTypedArray, isURIError, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, isValidType, isWeakMap, isWeakSet, isWindow, kindOf, kindOfMany, nodePlugin, noneOfType, partition, partitionByType, performanceMonitor, reactPlugin, someOfType, toArray, toBigInt, toBoolean, toBuffer, toDate, toError, toFunction, toMap, toNumber, toObject, toPromise, toRegExp, toSet, toString, toSymbol, toTypedArray, typeOf, validateSchema };
export type { AsyncFunction, AsyncGeneratorFunction, DetailedType, Falsy, GeneratorFunction$1 as GeneratorFunction, InspectOptions, KindOfInstance, Nullish, PerformanceMetrics, PluginOptions, Primitive, SchemaArray, SchemaObject, SchemaType, TypeChecker, TypeMap, TypeName, TypePlugin, TypeString, TypedArray$1 as TypedArray, ValidationError, ValidationOptions, ValidationResult, ValidationWarning };
