vue-ts-types
Version:
Lightweight TypeScript-first Vue prop type definitions
22 lines (21 loc) • 873 B
TypeScript
import type { DefaultPropOptions, RequiredPropOptions } from '../types';
import type { Validator } from '../validators';
interface FunctionPropOptionsGenerator<T> {
optional: DefaultPropOptions<T | undefined> & {
default?: () => T;
};
nullable: DefaultPropOptions<T | null> & {
default?: (() => T) | null;
};
required: RequiredPropOptions<T> & {
default?: () => T;
};
}
/**
* Allows any function. No further runtime validation is performed by default.
*
* @template T - can be used to restrict the type to a specific function signature at compile time.
* @param validator - Optional function for further runtime validation; should return `undefined` if valid, or an error string if invalid.
*/
export declare const functionProp: <T extends Function>(validator?: Validator) => FunctionPropOptionsGenerator<T>;
export {};