Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/vue-simple-props. Remove emits, slots, and attrs concepts in Vue.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152import type { ComponentPropsOptions, DefineSetupFnComponent, EmitsOptions, EmitsToProps, SetupContext, ShortEmitsToObject, Slots, SlotsType, FunctionalComponent as VueFunctionalComponent,} from 'vue'
type RemovePrefix< K extends string, P extends string,> = K extends `${P}${infer Event}` ? Uncapitalize<Event> : never
export type ExtractProps<T> = Omit<T, `render${string}`> & Partial<Pick<T, keyof T & `render${string}`>>export type ExtractEvent<T> = { [P in keyof T as RemovePrefix<string & P, 'on'>]: T[P]}export type ExtractSlots<T> = { [P in keyof T as RemovePrefix<string & P, 'render'>]: T[P]}
export type ComponentType<T extends Record<any, any>> = DefineSetupFnComponent< ExtractProps<T>, ExtractEvent<T>, SlotsType<ExtractSlots<T>>>
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : Nexport interface FunctionalComponent< P = {}, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any, EE extends EmitsOptions = ShortEmitsToObject<E>,> { ( props: P & EmitsToProps<EE>, ctx: SetupContext<EE, IfAny<S, {}, SlotsType<S>>>, ): any props?: ComponentPropsOptions<P> emits?: EE | (keyof EE)[] slots?: IfAny<S, Slots, SlotsType<S>> expose?: string[] inheritAttrs?: boolean displayName?: string compatConfig?: VueFunctionalComponent['compatConfig']}