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

Fix tests #68

Merged
merged 2 commits into from
Aug 17, 2016
Merged

Fix tests #68

merged 2 commits into from
Aug 17, 2016

Conversation

danharper
Copy link
Collaborator

Background:

So today a bug in Babylon was fixed. Previously, the locations on function params included the type annotation, but arrow functions didn't. (which was the cause of #47)

This meant that the getParameterName output for an arrow-function param would be { lorem, ipsum, dolor }, and normal function params would be { lorem, ipsum, dolor }: SomeType (includes the type annotation).

Now, we can either update the tests so arrow functions standardise with normal functions ({ lorem, ipsum, dolor }: SomeType) or update the code to have the cleaner output that we previously had for arrows, but for all functions types: { lorem, ipsum, dolor }


I'd say it's a little hacky, basically getting the source for the entire param, and stripping out the source of the type annotation.

Could either change arrow function expected output to match normal functions,
or some up with a nicer output in general

e.g. given:

function foo({ lorem, ipsum, dolor } : SomeType) {}
({ lorem, ipsum, dolor } : SomeType) => {}

before arrows would print:
{ lorem, ipsum, dolor }

and functions would print:
{ lorem, ipsum, dolor } : SomeType

now they both print:

{ lorem, ipsum, dolor }
@gajus gajus merged commit 31b1854 into gajus:master Aug 17, 2016
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.

None yet

2 participants