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

Object.entries/Object.values – values inference on second overload #95

Closed
akellbl4 opened this issue Mar 3, 2023 · 5 comments
Closed

Comments

@akellbl4
Copy link

akellbl4 commented Mar 3, 2023

Hey @mattpocock,
I see your reasoning under not adding Object.entries and from my understanding it's connected to the keys on an object.
But what about values?
TS defines values there as any so it feels unsafe.

  • Object.entries(o: {}): [string, any][];
  • Object.values(o: {}): any[];

I'm not sure if ts-reset should infer values or we should leave it as unknown.
In case I'm using zod when I receive data and then do some operations on it I'd prefer to have inference.

@mattpocock
Copy link
Owner

@akellbl4
Copy link
Author

akellbl4 commented Mar 3, 2023

@mattpocock
Copy link
Owner

Aha, didn't see that sneaky second overload there. Yes, that's definitely worthy of our attention.

@mattpocock mattpocock reopened this Mar 4, 2023
@mattpocock mattpocock changed the title Object.entries/Object.values – values inference Object.entries/Object.values – values inference on second overload Mar 4, 2023
@mattpocock
Copy link
Owner

Whoops, this is a duplicate of #78

@akellbl4
Copy link
Author

akellbl4 commented Mar 8, 2023

@mattpocock I initially posted on that issue XD

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

No branches or pull requests

2 participants