1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-28 07:49:41 +01:00

Remove unnecessary type

This commit is contained in:
Thomas Rittson 2024-10-28 14:10:27 +10:00
parent 730db3545a
commit abb254cafb
No known key found for this signature in database
GPG Key ID: CDDDA03861C35E27

View File

@ -1,9 +1,7 @@
import { map } from "rxjs"; import { map } from "rxjs";
type ObjectWithId<TId> = { id: TId }; export const getById = <TId, T extends { id: TId }>(id: TId) =>
export const getById = <TId, T extends ObjectWithId<TId>>(id: TId) =>
map<T[], T>((objects) => objects.find((o) => o.id === id)); map<T[], T>((objects) => objects.find((o) => o.id === id));
export const getByIds = <TId, T extends ObjectWithId<TId>>(ids: TId[]) => export const getByIds = <TId, T extends { id: TId }>(ids: TId[]) =>
map<T[], T[]>((objects) => objects.filter((o) => ids.includes(o.id))); map<T[], T[]>((objects) => objects.filter((o) => ids.includes(o.id)));