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: allow calling methods on null when self is of an optional type #1567

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Gusarich
Copy link
Member

Issue

Closes #1283.

Checklist

  • I have updated CHANGELOG.md
  • I have documented my contribution in docs/ and made the build locally
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

@Gusarich Gusarich requested a review from a team as a code owner January 25, 2025 07:16
}

// Return the only candidate
return registerExpType(ctx, exp, candidates[0]!.f.returns);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (candidates.length === 0)
candidates[0]!

->

const candidate = candidates[0];
if (typeof candidate === 'undefined') { ... }
// now candidate is not falsy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@verytactical have a look now

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.

Calling methods on null when self is of an optional type should be allowed
2 participants