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

set & flatKeys | better return type | stricter input type #54

Closed
Maggi64 opened this issue Mar 4, 2023 · 0 comments · Fixed by #75
Closed

set & flatKeys | better return type | stricter input type #54

Maggi64 opened this issue Mar 4, 2023 · 0 comments · Fixed by #75

Comments

@Maggi64
Copy link
Owner

Maggi64 commented Mar 4, 2023

With tools like hotscript or advanced TS magic we might be able to improve the return type and validate the given path on compile time.

It should be:

const obj = { a: 1 };
const newObj = set(obj, 'a.c', 1);
//      ^?  { a: { c: number } }

Instead of the current state:

const obj = { a: 1 };
const newObj = set(obj, 'a.c', 1);
//      ^?  PlainObject
@Maggi64 Maggi64 added improvement help wanted Extra attention is needed labels Mar 4, 2023
@Maggi64 Maggi64 changed the title set | better return type | stricter input type set & flatKeys | better return type | stricter input type Mar 4, 2023
@Maggi64 Maggi64 linked a pull request Mar 22, 2023 that will close this issue
@Maggi64 Maggi64 removed the help wanted Extra attention is needed label Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant