assertProp() — vue Function Reference
Architecture documentation for the assertProp() function in props.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD dcde110b_8854_c944_bfb4_3d5581f6359e["assertProp()"] 50f52114_04b8_bc98_a41e_bc26a88ea2ab["validateProp()"] 50f52114_04b8_bc98_a41e_bc26a88ea2ab -->|calls| dcde110b_8854_c944_bfb4_3d5581f6359e a8c8f192_fd2d_dbe3_46ed_dd8fabebc429["warn()"] dcde110b_8854_c944_bfb4_3d5581f6359e -->|calls| a8c8f192_fd2d_dbe3_46ed_dd8fabebc429 0e75b5c0_cbef_bb97_2108_927f30ffcea6["assertType()"] dcde110b_8854_c944_bfb4_3d5581f6359e -->|calls| 0e75b5c0_cbef_bb97_2108_927f30ffcea6 f8ecec2a_1fad_8b20_e61a_042f9e543aa9["getInvalidTypeMessage()"] dcde110b_8854_c944_bfb4_3d5581f6359e -->|calls| f8ecec2a_1fad_8b20_e61a_042f9e543aa9 style dcde110b_8854_c944_bfb4_3d5581f6359e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/util/props.ts lines 105–147
function assertProp(
prop: PropOptions,
name: string,
value: any,
vm?: Component,
absent?: boolean
) {
if (prop.required && absent) {
warn('Missing required prop: "' + name + '"', vm)
return
}
if (value == null && !prop.required) {
return
}
let type = prop.type
let valid = !type || (type as any) === true
const expectedTypes: string[] = []
if (type) {
if (!isArray(type)) {
type = [type]
}
for (let i = 0; i < type.length && !valid; i++) {
const assertedType = assertType(value, type[i], vm)
expectedTypes.push(assertedType.expectedType || '')
valid = assertedType.valid
}
}
const haveExpectedTypes = expectedTypes.some(t => t)
if (!valid && haveExpectedTypes) {
warn(getInvalidTypeMessage(name, value, expectedTypes), vm)
return
}
const validator = prop.validator
if (validator) {
if (!validator(value)) {
warn(
'Invalid prop: custom validator check failed for prop "' + name + '".',
vm
)
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does assertProp() do?
assertProp() is a function in the vue codebase.
What does assertProp() call?
assertProp() calls 3 function(s): assertType, getInvalidTypeMessage, warn.
What calls assertProp()?
assertProp() is called by 1 function(s): validateProp.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free