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

feat(utilities): add objectValues function #474

Merged

Conversation

RealShadowNova
Copy link
Contributor

@RealShadowNova RealShadowNova commented Sep 30, 2022

Resolves #456

@RealShadowNova RealShadowNova requested review from kyranet and imranbarbhuiya and removed request for favna, vladfrangu, kyranet and imranbarbhuiya October 1, 2022 13:48
imranbarbhuiya
imranbarbhuiya previously approved these changes Oct 1, 2022
@@ -0,0 +1,5 @@
import type { NonNullObject } from './utilityTypes';

export function objectValues<T extends NonNullObject>(obj: T): T extends ArrayLike<any> ? T[number][] : T[keyof T][] {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this use T extends ArrayLike<infer Values> ? Values[] : T[keyof T][]?

Copy link
Member

Choose a reason for hiding this comment

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

I guess both work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is Values in this context?

vladfrangu
vladfrangu previously approved these changes Oct 1, 2022
packages/utilities/src/lib/objectValues.ts Outdated Show resolved Hide resolved
@favna favna dismissed stale reviews from vladfrangu and imranbarbhuiya via 1abbd38 October 1, 2022 15:36
@favna favna merged commit 90c2409 into sapphiredev:main Oct 1, 2022
@RealShadowNova RealShadowNova deleted the feat/add-strictly-typed-object-values branch October 1, 2022 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

request: add objectValues (a strictly typed Object.values) to @sapphire/utilities
5 participants