# All files / src/types componentPublicInstance.ts

0% Statements 0/1
100% Branches 0/0
100% Functions 0/0
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

     import type { Doraemon } from '../instance/init'
    import type { DefaultComputed, DefaultMethods, ExtractComputedReturns } from './options'

    // If the type T accepts type "any", output type Y, otherwise output type N.
    // https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
    export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
    export type Prettify<T> = { [K in keyof T]: T[K] } & {}
    export interface ComponentCustomProperties {}
    export type ComponentPublicInstance<
      D extends Doraemon = Doraemon,
      Props = {},
      RawBindings = {},
      Data = {},
      Computed extends DefaultComputed = {},
      Methods extends DefaultMethods<D> = {},
      PublicProps = Props
    > = Pick<D, '$options' | '$emit' | '$nextTick'> & {
      $data: Data
      $props: Prettify<Props> & PublicProps
      $refs: { [key: string]: ComponentPublicInstance | ComponentPublicInstance[] | undefined }
      $root: ComponentPublicInstance | undefined
      $parent: ComponentPublicInstance | undefined
      $children: ComponentPublicInstance[] | undefined
    } & IfAny<Props, Props, Omit<Props, keyof RawBindings>> &
      RawBindings &
      ExtractComputedReturns<Computed> &
      Methods &
      ComponentCustomProperties