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

Replace WeakMap with private fields #786

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Apr 20, 2022

The KeyringController used a WeakMap to keep the keyring as a truly private field, such that code with a reference to the controller still could not access it.

This strategy is no longer necessary as of TypeScript 4.3 because we now have support for true private fields. The TypeScript compiler will compile this to a similar WeakMap-based strategy.

This should include no functional changes.

The `KeyringController` used a WeakMap to keep the keyring as a truly
private field, such that code with a reference to the controller still
could not access it.

This strategy is no longer necessary as of TypeScript 4.3 because we
now have support for true private fields. The TypeScript compiler will
compile this to a similar WeakMap-based strategy.

This should include no functional changes.
@Gudahtt Gudahtt requested a review from a team as a code owner April 20, 2022 14:53
@Gudahtt
Copy link
Member Author

Gudahtt commented Apr 20, 2022

I will migrate the private fields to # fields in a separate PR

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Yesss 👏🏻 I've been waiting for this 😅

@Gudahtt Gudahtt merged commit 480d682 into main Apr 20, 2022
@Gudahtt Gudahtt deleted the replace-private-weapmap-with-private-fields branch April 20, 2022 15:39
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The `KeyringController` used a WeakMap to keep the keyring as a truly
private field, such that code with a reference to the controller still
could not access it.

This strategy is no longer necessary as of TypeScript 4.3 because we
now have support for true private fields. The TypeScript compiler will
compile this to a similar WeakMap-based strategy.

This should include no functional changes.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The `KeyringController` used a WeakMap to keep the keyring as a truly
private field, such that code with a reference to the controller still
could not access it.

This strategy is no longer necessary as of TypeScript 4.3 because we
now have support for true private fields. The TypeScript compiler will
compile this to a similar WeakMap-based strategy.

This should include no functional changes.
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