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

Implement the Map interface #326

Closed
wants to merge 1 commit into from

Conversation

alexgleason
Copy link
Contributor

I want to pass lru-cache into my custom class, which accepts any Map.

lru-cache and ttl-cache work perfectly in runtime, but I have to cast them using cache as Map<string, T>.

I added implements Map<K, V> to this class, and tweaked it to match. All it needed was a few type assertions, and the addition of [Symbol.toStringTag]. No functionality is changed.

@alexgleason
Copy link
Contributor Author

@isaacs Bump

@isaacs isaacs closed this in 1fb1167 Jan 25, 2024
@isaacs
Copy link
Owner

isaacs commented Jan 25, 2024

Shipped on 10.2, thanks!

@alexgleason
Copy link
Contributor Author

@isaacs Thank you!

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