File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -737,14 +737,19 @@ function assertType(
737737 valid = t === expectedType . toLowerCase ( )
738738 // for primitive wrapper objects
739739 if ( ! valid && t === 'object' ) {
740- valid = value instanceof ( type as PropConstructor )
740+ // Guard against invalid prop type definitions (e.g. 'object', {}, etc.)
741+ // Only attempt instanceof when the provided type is a function/constructor.
742+ valid = isFunction ( type ) && value instanceof ( type as PropConstructor )
741743 }
742744 } else if ( expectedType === 'Object' ) {
743745 valid = isObject ( value )
744746 } else if ( expectedType === 'Array' ) {
745747 valid = isArray ( value )
746748 } else {
747- valid = value instanceof ( type as PropConstructor )
749+ // Fallback to constructor check only when type is a function.
750+ // This avoids errors like "Right-hand side of 'instanceof' is not an object"
751+ // when users mistakenly pass invalid values (e.g. strings) in prop type.
752+ valid = isFunction ( type ) && value instanceof ( type as PropConstructor )
748753 }
749754 return {
750755 valid,
You can’t perform that action at this time.
0 commit comments