Skip to content

Commit

Permalink
fix(types): allow attaching unknown options to defined component
Browse files Browse the repository at this point in the history
fix #12742
  • Loading branch information
yyx990803 committed Aug 18, 2022
1 parent 80d1baf commit b4bf4c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions types/test/v3/define-component-test.tsx
Expand Up @@ -1165,3 +1165,7 @@ defineComponent({
return h('div', {}, [...this.$slots.default!])
}
})

// #12742 allow attaching custom properties (consistent with v3)
const Foo = defineComponent({})
Foo.foobar = 123
3 changes: 3 additions & 0 deletions types/v3-component-options.d.ts
Expand Up @@ -88,6 +88,9 @@ export interface ComponentOptionsBase<
'data' | 'computed' | 'methods' | 'setup' | 'props' | 'mixins' | 'extends'
>,
ComponentCustomOptions {
// allow any options
[key: string]: any

// rewrite options api types
data?: (
this: CreateComponentPublicInstance<Props, {}, {}, {}, M, Mixin, Extends>,
Expand Down

0 comments on commit b4bf4c5

Please sign in to comment.