Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated types of replaceById and replaceBy #45

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions typeTemplates/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,22 +301,30 @@ export function _renameKeys<M extends { [key: string]: string }>(
entityArray: NilOr<T[]>
) => NilOr<(Omit<T, keyof M> & { [key: string]: any })[]>;

export function replaceBy<T>(pattern: MatchPattern<T>, entityArray: T[]): T[];
export function replaceBy(pattern: MatchPattern): <T>(entityArray: T[]) => T[];
export function replaceBy<T>(pattern: MatchPattern<T>, newItem: T, entityArray: T[]): T[];
export function replaceBy(pattern: MatchPattern): <T>(newItem: T, entityArray: T[]) => T[];
export function replaceBy<T>(pattern: MatchPattern<T>, newItem: T): (entityArray: T[]) => T[];
export function _replaceBy<T>(
pattern: MatchPattern<T>,
newItem: T,
entityArray: NilOr<T[]>
): NilOr<T[]>;
export function _replaceBy(
pattern: MatchPattern
): <T>(entityArray: NilOr<T[]>) => NilOr<T[]>;
): <T>(newItem: T, entityArray: NilOr<T[]>) => NilOr<T[]>;
export function _replaceBy<T>(
pattern: MatchPattern<T>,
newItem: T
): (entityArray: NilOr<T[]>) => NilOr<T[]>;

export function replaceById<T>(id: any, entityArray: T[]): T[];
export function replaceById(id: any): <T>(entityArray: T[]) => T[];
export function _replaceById<T>(id: any, entityArray: NilOr<T[]>): NilOr<T[]>;
export function replaceById<T>(id: any, newItem: T, entityArray: T[]): T[];
export function replaceById(id: any): <T>(newItem: T, entityArray: T[]) => T[];
export function replaceById<T>(id: any, newItem: T): (entityArray: T[]) => T[];
export function _replaceById<T>(id: any, newItem: T, entityArray: NilOr<T[]>): NilOr<T[]>;
export function _replaceById(
id: any
): <T>(entityArray: NilOr<T[]>) => NilOr<T[]>;
): <T>(newItem: T, entityArray: NilOr<T[]>) => NilOr<T[]>;
export function _replaceById<T>(id: any, newItem: T): (entityArray: NilOr<T[]>) => NilOr<T[]>;

export function serializeKeysToSnakeCase(object: object): object;
export function preprocessForSerialization(object: object): object;
Expand Down