@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and
76 lines (75 loc) • 1.94 kB
TypeScript
/**
* Common utility types for NeuroLink
*/
/**
* Type-safe unknown value - use when type is truly unknown
*/
export type Unknown = unknown;
/**
* Type-safe record for metadata and configuration objects
*/
export type UnknownRecord = Record<string, unknown>;
/**
* Type-safe array of unknown items
*/
export type UnknownArray = unknown[];
/**
* JSON-serializable value type
*/
export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
export interface JsonObject {
[key: string]: JsonValue;
}
export interface JsonArray extends Array<JsonValue> {
}
/**
* Type-safe error handling
*/
export interface ErrorInfo {
message: string;
code?: string | number;
stack?: string;
cause?: unknown;
}
/**
* Generic success/error result type
*/
export interface Result<T = unknown, E = ErrorInfo> {
success: boolean;
data?: T;
error?: E;
}
/**
* Function parameter type for dynamic functions
*/
export interface FunctionParameters {
[key: string]: unknown;
}
/**
* Generic async function type
*/
export type AsyncFunction<TParams = FunctionParameters, TResult = unknown> = (params: TParams) => Promise<TResult>;
/**
* Sync function type
*/
export type SyncFunction<TParams = FunctionParameters, TResult = unknown> = (params: TParams) => TResult;
/**
* Union of async and sync functions
*/
export type AnyFunction<TParams = FunctionParameters, TResult = unknown> = AsyncFunction<TParams, TResult> | SyncFunction<TParams, TResult>;
/**
* Type guard to check if value is Error
*/
export declare function isError(value: unknown): value is Error;
/**
* Type guard to check if value is ErrorInfo
*/
export declare function isErrorInfo(value: unknown): value is ErrorInfo;
/**
* Safe error message extraction
*/
export declare function getErrorMessage(error: unknown): string;
/**
* Safe error conversion
*/
export declare function toErrorInfo(error: unknown): ErrorInfo;