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

polish(ast): prefer undefined over empty arrays #4206

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR requested a review from a team as a code owner September 27, 2024 08:10
@yaacovCR yaacovCR added the PR: polish 💅 PR doesn't change public API or any observed behaviour label Sep 27, 2024
Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit aee3bb9
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/66f86f6a7bc8780008fe03e3
😎 Deploy Preview https://deploy-preview-4206--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@yaacovCR yaacovCR marked this pull request as draft September 27, 2024 08:49
@yaacovCR yaacovCR closed this Sep 27, 2024
@yaacovCR yaacovCR reopened this Sep 28, 2024
@yaacovCR
Copy link
Contributor Author

Well, it works!

It would seem that it's more accurate to use undefined when an optionalMany(...) is skipped entirely and an empty array when it is found, but has an empty list. So, it would seem that this PR is technically more correct.

Peeking around at https://astexplorer.net/ it seems that TS parser has some empty arrays, some undefined, while for Babel I didn't on a very cursory look see any undefined.

But still not 100% sure this is too compelling, with the status quo being somewhat compelling! Comments welcome!

@yaacovCR yaacovCR marked this pull request as ready for review September 28, 2024 21:09
@yaacovCR yaacovCR marked this pull request as draft October 1, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: polish 💅 PR doesn't change public API or any observed behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants