Skip to content

Conversation

@decadef20
Copy link
Contributor

fix #196 ,

}
render(h) {
return <div >
<h1>{this.title}</h1>
Copy link
Member

@HerringtonDarkholme HerringtonDarkholme Dec 28, 2017

Choose a reason for hiding this comment

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

IIRC tsx requires additional type declaration under strict: true flag. Will this compile?

"removeComments": true
"removeComments": true,
"jsx": "preserve",
"noImplicitAny": false

Choose a reason for hiding this comment

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

OK, setting noImplicitAny is a workaround. But I would still recommend to add JSXElement declaration.

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.

Adding JSX related typing is documented in
http://www.typescriptlang.org/docs/handbook/jsx.html

noImplicitAny is an important guarantee for type safety so I think we should keep it on.

@decadef20
Copy link
Contributor Author

Thanks for your recommendation.I have added jsx typing. Please check again.

example/.babelrc Outdated
@@ -0,0 +1,8 @@
{
"presets": [
["env", {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this preset and transform-decorators-legacy since we already transpile the code by TypeScript. Can we remove them from babelrc?

}
render(h: CreateElement) {
return <div >
<h1>{this.title}</h1>
Copy link
Member

Choose a reason for hiding this comment

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

Can we simplify the render function and the component definition more? I think it could have only one simple element since we just want to show tsx is available in this component. props/methods/computed shouldn't be there since they just complicate the example, IMO.

@decadef20
Copy link
Contributor Author

updated .babelrc and simplified the render function.please review it again.

Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ktsn ktsn merged commit 6095c0f into vuejs:master Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants