You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, could you please add support for the type guards for the partition function.
Use case:
functionisNumber(value: unknown): value is number{returntypeofvalue==='number'&&!Number.isNaN(value);}constsomeList: Array<unknown>=['bla','foo','bar',1,2,3,undefined,null];const[numbers,others]=R.partition(isNumber,someList);
Currently, both numbers and others arrays type is unknown[]. It would be helpful if the numbers type is number[].
We used the patch package to temporarily fix this:
diff --git [a/node_modules/@types/ramda/index.d.ts](mailto:a/node_modules/@types/ramda/index.d.ts) [b/node_modules/@types/ramda/index.d.ts](mailto:b/node_modules/@types/ramda/index.d.ts)
index 402e443..0a3040f 100755
--- [a/node_modules/@types/ramda/index.d.ts](mailto:a/node_modules/@types/ramda/index.d.ts)+++ [b/node_modules/@types/ramda/index.d.ts](mailto:b/node_modules/@types/ramda/index.d.ts)@@ -3733,7 +3733,9 @@ export function partialRight<T>(fn: (...args: any[]) => T, args: unknown[]): (..
* ```
*/
export function partition(fn: (a: string) => boolean, list: readonly string[]): [string[], string[]];
+export function partition<T, P>(fn: (a: T) => a is P, list: readonly T[]): [P[], T[]];
export function partition<T>(fn: (a: T) => boolean, list: readonly T[]): [T[], T[]];
+export function partition<T, P>(fn: (a: T) => a is P): (list: readonly T[]) => [P[], T[]];
export function partition<T>(fn: (a: T) => boolean): (list: readonly T[]) => [T[], T[]];
export function partition(fn: (a: string) => boolean): (list: readonly string[]) => [string[], string[]];
Please let us know if you need any help in this. Can help.
Cheers, Katarina
The text was updated successfully, but these errors were encountered:
Hi, could you please add support for the type guards for the
partition
function.Use case:
Currently, both
numbers
andothers
arrays type isunknown[]
. It would be helpful if thenumbers
type isnumber[]
.We used the patch package to temporarily fix this:
Please let us know if you need any help in this. Can help.
Cheers, Katarina
The text was updated successfully, but these errors were encountered: