Skip to content

Conversation

cexbrayat
Copy link
Member

…d with defineComponent

Currently, when using TypeScript, a component defined with defineComponent can not be used in the components options:

const comp = defineComponent({})
defineComponent({
  components: { comp }
})

This example was throwing with:

The last overload gave the following error.
    Type { comp: new () => ComponentPublicInstance<unknown, unknown, unknown, {}, {}, VNodeProps>; } is not assignable to type Record<string, Component>.
      Property comp is incompatible with index signature.

This commit fixes the issue, and adds a simple repro in the dts tests.

…d with defineComponent

Currently, when using TypeScript, a component defined with `defineComponent` can not be used in the `components` options:

```typescript
const comp = defineComponent({})
defineComponent({
  components: { comp }
})
```

This example was throwing with:

```
The last overload gave the following error.
    Type { comp: new () => ComponentPublicInstance<unknown, unknown, unknown, {}, {}, VNodeProps>; } is not assignable to type Record<string, Component>.
      Property comp is incompatible with index signature.
```

This commit fixes the issue, and adds a simple repro in the dts tests.
@cexbrayat cexbrayat force-pushed the fix/components-type branch from 76c6792 to a331117 Compare January 9, 2020 15:15
@yyx990803 yyx990803 merged commit 74baea1 into vuejs:master Jan 13, 2020
@yyx990803
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants