Home / File/ props.ts — vue Source File

props.ts — vue Source File

Architecture documentation for props.ts, a typescript file in the vue codebase. 7 imports, 0 dependents.

File typescript VueCore VDom 7 imports 11 functions

Entity Profile

Dependency Diagram

graph LR
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc["props.ts"]
  4be43750_5259_d6e1_902d_9b3e2df2b9c4["debug.ts"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> 4be43750_5259_d6e1_902d_9b3e2df2b9c4
  48bc61b1_05ca_3121_50a7_2f02cdcf2f03["warn"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> 48bc61b1_05ca_3121_50a7_2f02cdcf2f03
  af395f8e_1ac5_a239_71b7_fd29a1c03d2c["index.ts"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> af395f8e_1ac5_a239_71b7_fd29a1c03d2c
  b757abbc_61ef_2454_445e_6bb830e92333["observe"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> b757abbc_61ef_2454_445e_6bb830e92333
  c9e94feb_048a_387e_29a1_1567a76d119c["toggleObserving"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> c9e94feb_048a_387e_29a1_1567a76d119c
  09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b
  64c87498_c46a_6944_ab9d_8e45519852a8["component"]
  ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc --> 64c87498_c46a_6944_ab9d_8e45519852a8
  style ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { warn } from './debug'
import { observe, toggleObserving, shouldObserve } from '../observer/index'
import {
  hasOwn,
  isArray,
  isObject,
  isFunction,
  toRawType,
  hyphenate,
  capitalize,
  isPlainObject
} from 'shared/util'
import type { Component } from 'types/component'

type PropOptions = {
  type: Function | Array<Function> | null
  default: any
  required?: boolean
  validator?: Function
}

export function validateProp(
  key: string,
  propOptions: Object,
  propsData: Object,
  vm?: Component
): any {
  const prop = propOptions[key]
  const absent = !hasOwn(propsData, key)
  let value = propsData[key]
  // boolean casting
  const booleanIndex = getTypeIndex(Boolean, prop.type)
  if (booleanIndex > -1) {
    if (absent && !hasOwn(prop, 'default')) {
      value = false
    } else if (value === '' || value === hyphenate(key)) {
      // only cast empty string / same name to boolean if
      // boolean has higher priority
      const stringIndex = getTypeIndex(String, prop.type)
      if (stringIndex < 0 || booleanIndex < stringIndex) {
        value = true
      }
    }
  }
  // check default value
  if (value === undefined) {
    value = getPropDefaultValue(vm, prop, key)
    // since the default value is a fresh copy,
    // make sure to observe it.
    const prevShouldObserve = shouldObserve
    toggleObserving(true)
    observe(value)
    toggleObserving(prevShouldObserve)
  }
  if (__DEV__) {
    assertProp(prop, key, value, vm, absent)
  }
  return value
}

// ... (195 more lines)

Domain

Subdomains

Types

Dependencies

Frequently Asked Questions

What does props.ts do?
props.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in props.ts?
props.ts defines 11 function(s): assertProp, assertType, getInvalidTypeMessage, getPropDefaultValue, getType, getTypeIndex, isBoolean, isExplicable, isSameType, styleValue, and 1 more.
What does props.ts depend on?
props.ts imports 7 module(s): component, debug.ts, index.ts, observe, toggleObserving, util, warn.
Where is props.ts in the architecture?
props.ts is located at src/core/util/props.ts (domain: VueCore, subdomain: VDom, directory: src/core/util).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free