We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3e4f03 commit 96b4d76Copy full SHA for 96b4d76
packages/runtime-core/src/componentProps.ts
@@ -557,7 +557,13 @@ function validatePropName(key: string) {
557
// use function string name to check type constructors
558
// so that it works across vms / iframes.
559
function getType(ctor: Prop<any>): string {
560
- const match = ctor && ctor.toString().match(/^\s*function (\w+)/)
+ const ctorStr = ctor && ctor.toString()
561
+ let match: RegExpMatchArray | null
562
+ if (ctorStr.startsWith('class')) {
563
+ match = ctor && ctor.toString().match(/^\s*class (\w+)/)
564
+ } else {
565
+ match = ctor && ctor.toString().match(/^\s*function (\w+)/)
566
+ }
567
return match ? match[1] : ctor === null ? 'null' : ''
568
}
569
0 commit comments