assertProp() — vue Function Reference
Architecture documentation for the assertProp() function in props.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD d12d8448_7216_80ce_8a3d_b515beeca7cf["assertProp()"] e8576a88_2e85_86ff_b2f9_bbbb6de70a51["props.ts"] d12d8448_7216_80ce_8a3d_b515beeca7cf -->|defined in| e8576a88_2e85_86ff_b2f9_bbbb6de70a51 b943403b_6390_a1db_4eec_d4fea1238518["validateProp()"] b943403b_6390_a1db_4eec_d4fea1238518 -->|calls| d12d8448_7216_80ce_8a3d_b515beeca7cf e8b22500_20a5_2e19_4c79_386004841499["warn()"] d12d8448_7216_80ce_8a3d_b515beeca7cf -->|calls| e8b22500_20a5_2e19_4c79_386004841499 9aa11e66_4392_8ac7_ac29_01fd54a3d105["assertType()"] d12d8448_7216_80ce_8a3d_b515beeca7cf -->|calls| 9aa11e66_4392_8ac7_ac29_01fd54a3d105 35418adf_f9d4_27f6_03a5_03e0f0412d8d["getInvalidTypeMessage()"] d12d8448_7216_80ce_8a3d_b515beeca7cf -->|calls| 35418adf_f9d4_27f6_03a5_03e0f0412d8d style d12d8448_7216_80ce_8a3d_b515beeca7cf 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
Defined In
Called By
Source
Frequently Asked Questions
What does assertProp() do?
assertProp() is a function in the vue codebase, defined in src/core/util/props.ts.
Where is assertProp() defined?
assertProp() is defined in src/core/util/props.ts at line 105.
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