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

Use private methods instead of symbol keys #30

Merged
merged 6 commits into from
Jan 17, 2024
Merged

Conversation

EvanHahn
Copy link
Contributor

This change should have no user impact.

Before:

const kBar = Symbol('bar')

class Foo {
  [kBar]() { /* do something */ }

  twoBars() {
    this[kBar]()
    this[kBar]()
  }
}

After:

class Foo {
  #bar() { /* do something */ }

  twoBars() {
    this.#bar()
    this.#bar()
  }
}

@@ -66,15 +63,14 @@ class MultiCoreIndexer extends TypedEmitter {
this.#writeStream = /** @type {Writable<Entry<T>>} */ (
new Writable({
writev: (entries, cb) => {
// @ts-ignore - I don't know why TS does not like this
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why, but I was able to remove this @ts-ignore.

@EvanHahn EvanHahn requested a review from gmaclennan January 17, 2024 18:25
@EvanHahn EvanHahn marked this pull request as ready for review January 17, 2024 18:25
@EvanHahn EvanHahn requested a review from achou11 January 17, 2024 19:28
Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

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

lgtm!

@EvanHahn EvanHahn merged commit e73630a into main Jan 17, 2024
3 checks passed
@EvanHahn EvanHahn deleted the use-private-methods branch January 17, 2024 20:12
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.

2 participants