primevue-mirror/components/ts-helpers.d.ts

35 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-09-06 12:03:37 +00:00
import { ComponentCustomProps, VNodeProps, EmitsOptions, AllowedComponentProps, ObjectEmitsOptions } from 'vue';
declare type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
2022-09-14 11:26:01 +00:00
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
declare type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V>
? (event: V, ...args: any[]) => void
: {} extends Options
? (event: string, ...args: any[]) => void
: UnionToIntersection<
{
[key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : (event: key, ...args: any[]) => void;
}[Event]
>;
2022-09-06 12:03:37 +00:00
export class ClassComponent<Props, Slots, Emits extends EmitsOptions = {}> {
2022-09-14 11:26:01 +00:00
$props: Props & PublicProps;
$slots: Slots;
$emit: EmitFn<Emits>;
2022-09-06 12:03:37 +00:00
}
export type GlobalComponentConstructor<T> = {
2022-09-14 11:26:01 +00:00
new (): T;
};
2022-09-06 12:03:37 +00:00
/**
* Custom types
*/
export declare type Booleanish = boolean | 'true' | 'false';
export declare type Numberish = number | string;
export declare type Nullable<T = void> = T | null | undefined;