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

Avoid usage of logical nullish assignment for node 14 compatibility #1015

Conversation

alexander-schranz
Copy link

What:

Replace logical nullish assignement test ??= other with test = test ?? other.

Why:

For better compatibility.

See #1014

How:

Adopting the source files.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 2, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 08dbf36:

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration

@@ -98,7 +98,7 @@ export class KeyboardHost {
const target = getActiveElementOrBody(config.document)
this.setKeydownTarget(target)

this.pressed[code] ??= {
this.pressed[code] = this.pressed[code] ?? {
Copy link
Author

Choose a reason for hiding this comment

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

not sure about the eslint as that would mean if I understand correctly that the ??= is unnecessary here and we not even need a fallback?

/cc @ph-fritsche

@@ -41,7 +41,7 @@ export class PointerHost {
private registry = {} as Record<string, Device>

get(k: string) {
this.registry[k] ??= new Device()
this.registry[k] = this.registry[k] ?? new Device()
Copy link
Author

Choose a reason for hiding this comment

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

same as above here 🤔

@ph-fritsche
Copy link
Member

Thanks for contributing and trying to fix this ❤️

But I'll fix it in the build script instead of the source. Otherwise the problem would just be reintroduced later.

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