vue-ts-types
Version:
Lightweight TypeScript-first Vue prop type definitions
11 lines (10 loc) • 630 B
TypeScript
import type { PropOptionsGenerator } from '../types';
import type { Validator } from '../validators';
/**
* Allows any of the specified allowed values (validated at runtime and compile time).
*
* @template T - can be used to adjust the inferred type at compile time, this is usually not necessary.
* @param allowedValues - The allowed values.
* @param validator - Optional function for further runtime validation; should return `undefined` if valid, or an error string if invalid.
*/
export declare const oneOfProp: <T extends readonly unknown[]>(allowedValues: T, validator?: Validator) => PropOptionsGenerator<T[number]>;