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

Beautifying TypeScript adds extra spaces #555

Open
harlyq opened this issue Oct 5, 2014 · 8 comments
Open

Beautifying TypeScript adds extra spaces #555

harlyq opened this issue Oct 5, 2014 · 8 comments

Comments

@harlyq
Copy link

harlyq commented Oct 5, 2014

Although beautify is for javascript, it's very useful for formatting TypeScript, but it does tend to add a lot of extra white space.

For example:

blah ? : number // is better without the space between ? and : e.g. blah ?: number

and generics:

foo < T > (); // simpler without some of the spaces as foo<T>() or foo< T >()
@bitwiseman
Copy link
Member

As noted on the other bug, Typescript isn't really supported by the js-beautifier. But it's good to have this on the list. Thanks!

@stuhlmueller
Copy link

Similarly, for type annotations by flow:

function foo(x: ?number, y: ?boolean) {}

gets turned into

function foo(x: ? number, y : ? boolean) {}

but should remain unchanged.

@bitwiseman
Copy link
Member

@stuhlmueller - Please file your comment as a new issue. If we get around to implementing it, it won't be as part of fixing this issue.

@aight8
Copy link

aight8 commented Apr 17, 2017

Any update?

@wbhob
Copy link

wbhob commented Jun 9, 2017

@bitwiseman what's the status of these fixes?

@bitwiseman
Copy link
Member

bitwiseman commented Jun 9, 2017

@wbhob -
These enhancements are awaiting someone with time to implement them.

Point-wise changes to provide parts of this feature, blah ?: number for example, would be easy enough to implement. Other parts, such as generics, would be more involved.

#1147 is much the same as this.

@wbhob
Copy link

wbhob commented Jun 10, 2017

@bitwiseman should typescript be its own folder?

@bitwiseman
Copy link
Member

@wbhob -
I'm not sure. At this time, I think that would result in a lot of extra work and complexity.

The process of moving to having separate that inherit from javascript is starting, but it isn't there yet. For now, I'd suggest updating the Javascript language instead.

I'd suggest doing point-wise changes: pick one feature of TS/Flow and make that change with tests and commenting, finish a Pull request with that change, then pick another feature and so on. That will make it easier to review the changes and reduce the complexity of debugging any issues.

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

5 participants