Skip to content

Add a note about this type inference #1234

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

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

ktsn
Copy link
Member

@ktsn ktsn commented Oct 21, 2017

Although the recommended configuration has strict: true, I saw some people does not include it in their config and confused why this type is not inferred.

I guess the beginners of TypeScript may not understand what is stricter inference for data properties on this. So I added a more description about that.

Copy link
Member

@HerringtonDarkholme HerringtonDarkholme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@galenyuan
Copy link
Contributor

What about add a mention that export default Vue.extend({ ..ComponentOption }) is required?
I tried like this
image
but complier throw errors
image

@ktsn
Copy link
Member Author

ktsn commented Oct 22, 2017

@galenyuan It's already in docs...

To let TypeScript properly infer types inside Vue component options, you need to define components with Vue.component or Vue.extend:

@galenyuan
Copy link
Contributor

@ktsn but there is

Note that when using Vetur with SFCs, type inference will be automatically applied to the default export, so there’s no need to wrap it in Vue.extend:

in next paragraph, it's confused..

@HerringtonDarkholme
Copy link
Member

We have already removed that paragraph. Please patiently wait for deployment.

@ktsn
Copy link
Member Author

ktsn commented Oct 22, 2017

FYI #1226

@galenyuan
Copy link
Contributor

Aha, thanks guys~

@chrisvfritz chrisvfritz merged commit 9b82e2c into vuejs:master Oct 23, 2017
@ktsn ktsn deleted the update-typescript-guide branch October 24, 2017 00:28
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.

4 participants