Skip to content

Commit b4bf4c5

Browse files
committed
fix(types): allow attaching unknown options to defined component
fix #12742
1 parent 80d1baf commit b4bf4c5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: types/test/v3/define-component-test.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -1165,3 +1165,7 @@ defineComponent({
11651165
return h('div', {}, [...this.$slots.default!])
11661166
}
11671167
})
1168+
1169+
// #12742 allow attaching custom properties (consistent with v3)
1170+
const Foo = defineComponent({})
1171+
Foo.foobar = 123

Diff for: types/v3-component-options.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ export interface ComponentOptionsBase<
8888
'data' | 'computed' | 'methods' | 'setup' | 'props' | 'mixins' | 'extends'
8989
>,
9090
ComponentCustomOptions {
91+
// allow any options
92+
[key: string]: any
93+
9194
// rewrite options api types
9295
data?: (
9396
this: CreateComponentPublicInstance<Props, {}, {}, {}, M, Mixin, Extends>,

0 commit comments

Comments
 (0)