macoolka-error
Version:
`macoolka-cache` Build a cache for function
56 lines (55 loc) • 1.26 kB
TypeScript
/**
* @file
*/
import { WarnMessage } from './types';
/**
* @since 0.2.0
*/
export declare class PropNotFoundError extends Error {
framesToPop: number;
name: string;
constructor(message?: string);
}
/**
* @since 0.2.0
*/
export interface PropNotFoundProps {
/**
* Message Title
* @desczh
* 消息标题
*/
title?: string;
/**
* Message Content
* @desczh
* 消息
*/
message: string;
/**
* The Object be getted
* @desczh
* 指定的对象
*/
obj: {};
/**
* Property name in give obj
* @desczh
* 在指定的对象中的属性名
*/
propName: string | string[];
}
/**
* Throw a PropNotFoundError with message when obj's prop is empty
* @desczh
* 当对象中的属性为空时抛出PropNotFoundError
* @since 0.2.0
*/
export declare function propNotFound({ title, obj, propName, message }: PropNotFoundProps): any;
/**
* Call warn and return a defualt value with message when obj's prop is empty
* @desczh
* 当对象中的属性为空时返回缺省值并调用warn
* @since 0.2.0
*/
export declare function propNotFoundWarn<T>({ title, obj, propName, message, defaultValue, warn }: WarnMessage<PropNotFoundProps, T>): any;