Lib: Update type information

This commit is contained in:
2024-12-14 03:34:21 +01:00
parent 304ffd45ba
commit 2c5a7a1143

View File

@ -1,7 +1,7 @@
/**
* Retrieve an arbitrary object with a matching ID from an Array.
* Supposed to use on collections returned by the PocketBase API.
* Supposed to be used on collections returned by the PocketBase API.
*/
export const get_by_id = <T extends object>(objects: Array<T>, id: string): T | undefined => {
export const get_by_id = <T extends object>(objects: T[], id: string): T | undefined => {
return objects.find((o: T) => ("id" in o ? o.id === id : false));
};