Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PropType Function #748

Closed
hareku opened this issue Feb 20, 2020 · 0 comments
Closed

Improve PropType Function #748

hareku opened this issue Feb 20, 2020 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@hareku
Copy link
Contributor

hareku commented Feb 20, 2020

What problem does this feature solve?

A TypeScript error occures on this example code.

import { defineComponent, PropType } from 'vue'

export default defineComponent({
  props: {
    categories: {
    onSelect: {
      type: Function as PropType<(val: number) => void>, // TypeScript Error
      required: true
    }
  }
})
Conversion of type 'FunctionConstructor' to type 'PropType<(val: number) => void>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

We have to write with as unknown, but I feel this is redundant.

Function as unknown as PropType<(val: number) => void> //work as well

What does the proposed API look like?

Function as PropType<(val: number) => void>
@hareku hareku changed the title Improve PropType with Function Improve PropType Function Mar 11, 2020
@yyx990803 yyx990803 added the help wanted Extra attention is needed label Apr 3, 2020
pikax added a commit to pikax/vue-next that referenced this issue Apr 3, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants