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

Typescript - Component's property types are not correct #8579

Open
AntoineEsteve opened this issue Jul 30, 2018 · 2 comments
Open

Typescript - Component's property types are not correct #8579

AntoineEsteve opened this issue Jul 30, 2018 · 2 comments

Comments

@AntoineEsteve
Copy link

Version

Vuejs: 2.5.16
Typescript: 2.8.1

Reproduction link

https://stackblitz.com/edit/typescript-rrnw8z?file=index.ts

Steps to reproduce

  • Use typescript
  • Create a component with at least one property

What is expected?

If your property of type X is not required, its type should be X | undefined

What is actually happening?

If your property of type X is not required, its type is still X


More dangerous: The properties are not required by default and you can easily write code that will fail at runtime.

Note: The stackblitz above won't show the error because the types are not correctly assumed and this is assumed as any

@ktsn ktsn added the typescript label Aug 9, 2018
@KaelWD
Copy link
Contributor

KaelWD commented Aug 28, 2018

#6901 (comment)

@ChuChencheng
Copy link

Will this issue be fixed in Vue 3.x ?
Or how to correct it with TS 3.4+ ? 😕

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

No branches or pull requests

4 participants