Lib: Update type information
This commit is contained in:
@ -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));
|
||||
};
|
||||
|
Reference in New Issue
Block a user