Merge pull request #2036 from szeck87/typescript-fixes

Typescript fixes
This commit is contained in:
Glavin Wiechert 2018-02-08 15:37:45 -04:00 committed by GitHub
commit fb3f5e65ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 14 deletions

View File

@ -1,11 +1,11 @@
class Test extends React.Component<Foo> { class Test extends React.Component<Foo> {
render() { render() {
return ( return (
<div className= "class" > <div className="class">
<h2 className="anotherClass" > <h2 className="anotherClass">
{ this.foo.bar } {this.foo.bar}
< /h2> </h2>
{ this.foo.bar.children } {this.foo.bar.children}
</div> </div>
); );
} }

View File

@ -1,12 +1,12 @@
class Test extends React.Component<Foo> { class Test extends React.Component<Foo> {
render() { render() {
return ( return (
<div className="class"> <div className="class">
<h2 className="anotherClass"> <h2 className= "anotherClass">
{this.foo.bar} {this.foo.bar}
</h2> </h2>
{this.foo.bar.children} {this.foo.bar.children}
</div> </div>
); );
} }
} }

View File

@ -26,8 +26,13 @@ module.exports = class TypeScriptFormatter extends Beautifier
opts.indentSize = options.indent_size opts.indentSize = options.indent_size
opts.indentStyle = 'space' opts.indentStyle = 'space'
if language is "TSX"
fileName = 'test.tsx'
else
fileName = ''
@verbose('typescript', text, opts) @verbose('typescript', text, opts)
result = format('', text, opts) result = format(fileName, text, opts)
@verbose(result) @verbose(result)
resolve result resolve result
catch e catch e