Skip to content

Conversation

pikax
Copy link
Member

@pikax pikax commented Jan 18, 2021

// type is correct
defineComponent<{ a?: string }>({
  props: {
    a: String
  },

  setup(props) {
    props.a
  }
})

// error type is incorrect

//@ts-expect-error invalid type on the prop definition
defineComponent<{ a: number }>({
  props: {
    a: {
      type: String,
      required: true
    }
  },

  // @ts-expect-error cannot resolve props type because of the mismatch
  setup(props) {
    props.a
  }
})
  • Type tests are missing
  • There's an issue where optional and required don't show error
  • defining prop with a type: Object will accept arrays

@pikax pikax marked this pull request as draft January 18, 2021 16:56
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.

1 participant