Fix single optional arrow param printing #1002

Merged
merged 1 commit into from Mar 15, 2017

Conversation

Projects
None yet
3 participants
@danharper
Contributor

danharper commented Mar 14, 2017

Previously, a = (b?) => c; would print as a = b? => c; which is invalid syntax.

@jlongster

This comment has been minimized.

Show comment
Hide comment
@jlongster

jlongster Mar 15, 2017

Member

I don't understand what the b? syntax is. That is not valid JavaScript. Is that a proposal somewhere?

Member

jlongster commented Mar 15, 2017

I don't understand what the b? syntax is. That is not valid JavaScript. Is that a proposal somewhere?

@danharper

This comment has been minimized.

Show comment
Hide comment
@danharper

danharper Mar 15, 2017

Contributor

It's Flow syntax for an optional parameter.

Contributor

danharper commented Mar 15, 2017

It's Flow syntax for an optional parameter.

@danharper danharper closed this Mar 15, 2017

@danharper

This comment has been minimized.

Show comment
Hide comment
@danharper

danharper Mar 15, 2017

Contributor

Oops, didn't mean to close this.

Contributor

danharper commented Mar 15, 2017

Oops, didn't mean to close this.

@danharper danharper reopened this Mar 15, 2017

@vjeux

This comment has been minimized.

Show comment
Hide comment
@vjeux

vjeux Mar 15, 2017

Collaborator

Ohhh, so usually we write:

function f(a?: ?Type) {}

but it looks like you can omit the type annotation! Crazy :p

Collaborator

vjeux commented Mar 15, 2017

Ohhh, so usually we write:

function f(a?: ?Type) {}

but it looks like you can omit the type annotation! Crazy :p

@vjeux vjeux merged commit 332babe into prettier:master Mar 15, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@danharper danharper deleted the danharper:fixArrowSingleOptional branch Mar 15, 2017

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