diff --git a/package.json b/package.json index 83b77ed3..3da0105b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "radash", - "version": "7.1.0", + "version": "7.1.1", "description": "Functional utility library - modern, simple, typed, powerful", "main": "dist/cjs/index.cjs", "module": "dist/esm/index.mjs", diff --git a/src/array.ts b/src/array.ts index 2aef16bd..3564b4c2 100644 --- a/src/array.ts +++ b/src/array.ts @@ -3,7 +3,7 @@ * the group ids the given getGroupId function produced and the value is an array of * each item in that group. */ - export const group = ( +export const group = ( array: readonly T[], getGroupId: (item: T) => Key ) => { @@ -21,7 +21,10 @@ * * Ex. const greatest = () => boil(numbers, (a, b) => a > b) */ -export const boil = (array: readonly T[], compareFunc: (a: T, b: T) => T) => { +export const boil = ( + array: readonly T[], + compareFunc: (a: T, b: T) => T +) => { if (!array || (array.length ?? 0) === 0) return null return array.reduce(compareFunc) } @@ -310,7 +313,11 @@ export const fork = ( * and replace items matched by the matcher func in the * first place. */ -export const merge = (root: readonly T[], others: readonly T[], matcher: (item: T) => any) => { +export const merge = ( + root: readonly T[], + others: readonly T[], + matcher: (item: T) => any +) => { if (!others && !root) return [] if (!others) return root if (!root) return [] @@ -352,8 +359,8 @@ export const replaceOrAppend = ( * Given a list returns a new list with * only truthy values */ -export const sift = (list: readonly T[]) => { - return list?.filter(x => !!x) ?? [] +export const sift = (list: readonly T[]): NonNullable[] => { + return (list?.filter(x => !!x) as NonNullable[]) ?? [] } /**