Files
heroui-vue/tests/package/slider-contract.ts
T

25 lines
1005 B
TypeScript

import {
type SliderProps,
type SliderThumbProps,
Slider,
SliderTrack,
SliderThumb,
} from "@heroui-vue/components";
const valid: SliderProps = { modelValue: [20, 80], orientation: "vertical" };
const thumb: SliderThumbProps = { name: "max", index: 1, isDisabled: true };
// @ts-expect-error model is numeric
const invalid: SliderProps = { modelValue: "20" };
// @ts-expect-error orientation is constrained
const direction: SliderProps = { orientation: "diagonal" };
void [valid, thumb, invalid, direction, Slider, SliderTrack, SliderThumb];
import { type NumberFieldProps } from "@heroui-vue/components";
const numeric: NumberFieldProps = {
modelValue: null,
validate: (value) => (value === null ? "Required" : true),
};
// @ts-expect-error NumberField public values must remain numeric in NodeNext too
const badNumeric: NumberFieldProps = { modelValue: "12,5" };
// @ts-expect-error index is numeric
const badThumb: SliderThumbProps = { index: "1" };
void [numeric, badNumeric, badThumb];