props.ts — vue Source File
Architecture documentation for props.ts, a typescript file in the vue codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR e8576a88_2e85_86ff_b2f9_bbbb6de70a51["props.ts"] c11cafd0_9de7_a29e_a7df_dc098f20ea24["debug.ts"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> c11cafd0_9de7_a29e_a7df_dc098f20ea24 e8b22500_20a5_2e19_4c79_386004841499["warn"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> e8b22500_20a5_2e19_4c79_386004841499 012c0986_6b9d_ad59_8fba_57884312dd3b["index.ts"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> 012c0986_6b9d_ad59_8fba_57884312dd3b c50e49cd_c223_e73e_c96d_1c8391fde3c1["observe"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> c50e49cd_c223_e73e_c96d_1c8391fde3c1 2bcc88b5_db8a_b047_2abd_7382948898ab["toggleObserving"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> 2bcc88b5_db8a_b047_2abd_7382948898ab 156bf2e1_8a13_f22d_5437_54f14bcef8fa["util"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> 156bf2e1_8a13_f22d_5437_54f14bcef8fa 907f4994_ea28_43b1_7976_0db9f0e97637["component"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51 --> 907f4994_ea28_43b1_7976_0db9f0e97637 style e8576a88_2e85_86ff_b2f9_bbbb6de70a51 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
Functions
Types
Dependencies
- component
- debug.ts
- index.ts
- observe
- toggleObserving
- util
- warn
Source
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 CoreRuntime domain, VirtualDOM 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: CoreRuntime, subdomain: VirtualDOM, directory: src/core/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free