Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Support export component as ExtendedVue type in SFC #313

Open
Fnxxxxo opened this issue Dec 2, 2019 · 0 comments
Open

Support export component as ExtendedVue type in SFC #313

Fnxxxxo opened this issue Dec 2, 2019 · 0 comments
Milestone

Comments

@Fnxxxxo
Copy link

Fnxxxxo commented Dec 2, 2019

What problem does this feature solve?

I use the type parameter of ExtendedVue to complete compile-time validation of props. Currently, the SFC export component as VueConstructor type which does not support it and result in:

TS2322: Type 'VueConstructor<Vue>' is not assignable to type 'RenderDefType<unknown, unknown, unknown, DecoderPropsType>'.
  Type 'VueConstructor<Vue>' is not assignable to type 'ExtendedVue<Vue, unknown, unknown, unknown, DecoderPropsType>'.
    Type 'Vue' is not assignable to type 'DecoderPropsType & Vue'.
      Property 'data' is missing in type 'Vue' but required in type 'DecoderPropsType'. 

What does the proposed API look like?

I am using Vue.extend in SFC which holds all type information.

<script lang="ts">
  import Vue, { PropOptions } from 'vue'

  export default Vue.extend({
    name: 'unknown-decoder',
    props: {
      data: {} as PropOptions<any>
    }
  })
</script>

Just merge the type with Vue?

@znck znck added this to the Zero Issues milestone Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants