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

Investigate mapValues type mapping issue #6832

Open
nflaig opened this issue May 30, 2024 · 0 comments
Open

Investigate mapValues type mapping issue #6832

nflaig opened this issue May 30, 2024 · 0 comments
Labels
good first issue Issues that are suitable for first-time contributors. help wanted The author indicates that additional help is wanted. scope-devex Issues for improving developer experience.

Comments

@nflaig
Copy link
Member

nflaig commented May 30, 2024

Current implementation or rather the typing / generics of mapValues function to seem to be incorrect, requiring to type cast the returned value (although the implementation itself works as expected)

}) as unknown as ApiWithExtraOpts<Api>;

This is the current implementation which needs to be reviewed / reworked

export function mapValues<T extends {[K: string]: any}, R>(
obj: T,
iteratee: (value: T[keyof T], key: keyof T) => R
): {[K in keyof T]: R} {
const output = {} as {[K in keyof T]: R};
for (const [key, value] of Object.entries(obj)) {
output[key as keyof T] = iteratee(value, key);
}
return output;
}

See previous discussion for more context #6749 (comment)

@nflaig nflaig added help wanted The author indicates that additional help is wanted. scope-devex Issues for improving developer experience. labels May 30, 2024
@nflaig nflaig added the good first issue Issues that are suitable for first-time contributors. label Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are suitable for first-time contributors. help wanted The author indicates that additional help is wanted. scope-devex Issues for improving developer experience.
Projects
None yet
Development

No branches or pull requests

1 participant