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

State.nested does not work with symbol keys #374

Open
zroug opened this issue Jan 9, 2023 · 4 comments
Open

State.nested does not work with symbol keys #374

zroug opened this issue Jan 9, 2023 · 4 comments
Labels
enhancement New feature or request hookstate-5 Features postponed for v5

Comments

@zroug
Copy link

zroug commented Jan 9, 2023

const id = Symbol()
const state = hookstate({[id]: "Hello World!"})
console.log(state.nested(id).get())

Expected output is Hello World!, actual output is undefined, there is no runtime error or type error from TypeScript.

Hookstate should do one of two things:

  • Do not support symbol keys
    In this case, this should cause a type error for TypeScript and maybe a runtime error with a readable error message.
  • Support symbol keys

The latter is of course preferred but more difficult to achieve.

@3rma1
Copy link

3rma1 commented Jan 27, 2023

This library is dead, there is no support and there is no traction.

@zroug
Copy link
Author

zroug commented Jan 27, 2023

It's important to remember that this library is being developed by a single developer, most likely in his spare time. He may have other responsibilities or priorities that prevent him from working on the project as often as you would like. You always have the option to contribute or fork.

@avkonst
Copy link
Owner

avkonst commented Jan 30, 2023 via email

@avkonst avkonst added hookstate-5 Features postponed for v5 enhancement New feature or request labels Mar 31, 2023
@avkonst
Copy link
Owner

avkonst commented Mar 31, 2023

Symbols are possible to get and set on a state and state value. They are actually special and maybe used by plugins to associate hidden metadata. I will explore if it is possible to prevent the use case of nested(symbol) on a type system. If you can come up with type definition which traps it, it would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hookstate-5 Features postponed for v5
Projects
None yet
Development

No branches or pull requests

3 participants