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

feat: add babel plugin for optional chaining #356

Merged
merged 2 commits into from
Nov 11, 2019
Merged

Conversation

chrishavekost
Copy link
Contributor

Will allow anyone on newer versions of availity-workflow to use optional chaining in their apps. Turning something like:

return (
    (resp &&
      resp.data &&
      resp.data.regions &&
      resp.data.regions[0] &&
      resp.data.regions[0].id) ||
    undefined
  );

into:
return resp?.data?.regions?.[0]?.id

@GoPro16
Copy link
Contributor

GoPro16 commented Nov 7, 2019

I would recommend also updating the example project in this repo to use it so we can double confirm that the plugin does in fact work.

@TheSharpieOne
Copy link
Collaborator

This is in TS 3.7 and is coming to CRA as soon as other libs (prettier) support it (see facebook/create-react-app#7438).

I would suggest waiting else you will break things like prettier.

@TheSharpieOne
Copy link
Collaborator

Looks like everything is good to go! Those using vscode may run into prettier/prettier-vscode#1027

@GoPro16
Copy link
Contributor

GoPro16 commented Nov 11, 2019

Lol you referenced it and was immediately closed after.

@chrishavekost chrishavekost merged commit 9bb7249 into master Nov 11, 2019
@chrishavekost chrishavekost deleted the feat/chaining branch November 11, 2019 21:10
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.

3 participants