sodiray / radash

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

mapValues cannot be used with partial records due to Record argument type #354

Closed osdiab closed 11 months ago

osdiab commented 11 months ago

mapValues() expects a Record<Key, Value>. But other stuff in Radash returns Partial<Record>>s like group() (see #351 ). So you can't compose these together without casts because partial records are not assignable to 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

brettbedarfmw commented 11 months ago

Did you find a solution? This is causing problems for me

osdiab commented 11 months ago

Nope just had actually made another issue that's basically the same so I closed this one. In my codebase I just use a different pattern to achieve the same effect but it's still annoying