From 3966b74dc6112339e1839b2cd4752e6a76be777a Mon Sep 17 00:00:00 2001 From: Gaagul Gigi <70290286+gaagul@users.noreply.github.com> Date: Mon, 15 Jul 2024 22:54:23 +0530 Subject: [PATCH] Updated types of replaceById and replaceBy --- typeTemplates/index.d.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/typeTemplates/index.d.ts b/typeTemplates/index.d.ts index 47724d8..81f5a7d 100644 --- a/typeTemplates/index.d.ts +++ b/typeTemplates/index.d.ts @@ -301,22 +301,30 @@ export function _renameKeys( entityArray: NilOr ) => NilOr<(Omit & { [key: string]: any })[]>; -export function replaceBy(pattern: MatchPattern, entityArray: T[]): T[]; -export function replaceBy(pattern: MatchPattern): (entityArray: T[]) => T[]; +export function replaceBy(pattern: MatchPattern, newItem: T, entityArray: T[]): T[]; +export function replaceBy(pattern: MatchPattern): (newItem: T, entityArray: T[]) => T[]; +export function replaceBy(pattern: MatchPattern, newItem: T): (entityArray: T[]) => T[]; export function _replaceBy( pattern: MatchPattern, + newItem: T, entityArray: NilOr ): NilOr; export function _replaceBy( pattern: MatchPattern -): (entityArray: NilOr) => NilOr; +): (newItem: T, entityArray: NilOr) => NilOr; +export function _replaceBy( + pattern: MatchPattern, + newItem: T +): (entityArray: NilOr) => NilOr; -export function replaceById(id: any, entityArray: T[]): T[]; -export function replaceById(id: any): (entityArray: T[]) => T[]; -export function _replaceById(id: any, entityArray: NilOr): NilOr; +export function replaceById(id: any, newItem: T, entityArray: T[]): T[]; +export function replaceById(id: any): (newItem: T, entityArray: T[]) => T[]; +export function replaceById(id: any, newItem: T): (entityArray: T[]) => T[]; +export function _replaceById(id: any, newItem: T, entityArray: NilOr): NilOr; export function _replaceById( id: any -): (entityArray: NilOr) => NilOr; +): (newItem: T, entityArray: NilOr) => NilOr; +export function _replaceById(id: any, newItem: T): (entityArray: NilOr) => NilOr; export function serializeKeysToSnakeCase(object: object): object; export function preprocessForSerialization(object: object): object;