sodiray / radash

Functional utility library - modern, simple, typed, powerful
https://radash-docs.vercel.app
MIT License
4.18k stars 167 forks source link

Group cannot be used with mapValues due to Partial return type #351

Open osdiab opened 1 year ago

osdiab commented 1 year ago

Hello, not sure what an elegant solution would be, but I'm finding that I cannot do mapValues(group(...)) because mapValues demands a Record<Key, Value> whereas group() returns a Partial<Record<Key, Value>>. maybe the mapValues() function type signature can be broadened a bit to allow for partial records?

https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&allowUnreachableCode=true&allowUnusedLabels=true&noUnusedLocals=true&noUnusedParameters=true&exactOptionalPropertyTypes=true&noFallthroughCasesInSwitch=true&noImplicitOverride=true&noPropertyAccessFromIndexSignature=true&useUnknownInCatchVariables=true&suppressImplicitAnyIndexErrors=true&allowSyntheticDefaultImports=true#code/JYWwDg9gTgLgBAbzgcyhArmANHEBDMANTwBt0BTAZzgF84AzNEOAIijwBM9KALFgbgBQgmAE8w5OMTKSAvKzws4AH1YAjJapYBjFoO0QAdpXgA3UhUoAuKRfIBtALpx5T-UZNwwabVUrkOaUsXXAIgqgAKVAwwCPMZShxTFwA+OFMASiS7VLgAAwAJYDgAEgR4iho8jP4gA

aleclarson commented 2 months ago

Hi @osdiab, this issue has a fix available in radashi@beta today (see #24). An official release is pending. We'd love to have you participate in the discussion and/or development of the radashi-org/radashi fork. 😄