import type { AllowedComponentProps, ComponentOptions, DefineComponent, GlobalComponents, Ref, VNodeProps } from 'vue';

declare module '*.vue' {
  const component: DefineComponent;
  export default component;
}

type _Renderable = ComponentOptions<any> & (abstract new (...args: any[]) => any);
type _Comp1<T extends keyof GlobalComponents> = InstanceType<GlobalComponents[T]>;
type _Comp2<T extends _Renderable> = InstanceType<T>;
declare global {
  type $Comp<T extends _Renderable | keyof GlobalComponents> = T extends keyof GlobalComponents ? _Comp1<T> : T extends _Renderable ? _Comp2<T> : unknown;
  type $RefComp<T extends _Renderable | keyof GlobalComponents> = Ref<$Comp<T> | null>;
  type $Props<T extends _Renderable | keyof GlobalComponents> = {
    -readonly [K in keyof Omit<$Comp<T>['$props'], keyof AllowedComponentProps | keyof VNodeProps>]: $Comp<T>['$props'][K];
  };
}

export {};
