UNPKG

@rest-api/react-models

Version:

[![npm version](https://img.shields.io/npm/v/@rest-api/react-models)](https://www.npmjs.com/package/@rest-api/react-models) [![codecov](https://codecov.io/gh/hector7/rest-api-react-models/branch/master/graph/badge.svg)](https://codecov.io/gh/hector7/rest-

16 lines (15 loc) 1.01 kB
import { RestModel } from '../models/restmodels'; import { Schema, StringOrNumberKeys } from '../models/Schema'; import { ReducerType } from '../models/ReducerStorage'; export default class BasicIdReducer<S extends Schema<any>, IdKey extends StringOrNumberKeys<S['RealType']> & StringOrNumberKeys<S['PopulatedType']> & string> { private restModel; constructor(model: RestModel<{}, S, IdKey, any, any>); private getReducer; getById(state: ReducerType, id: S['RealType'][IdKey]): S['RealType'] | null; getByIdPopulated(state: ReducerType, id: S['RealType'][IdKey]): S['PopulatedType'] | null; getIdError(state: ReducerType, id: S['RealType'][IdKey]): import("../..").HttpError | null; isIdInitialized(state: ReducerType, id: S['RealType'][IdKey]): boolean; isIdPopulated(state: ReducerType, id: S['RealType'][IdKey]): boolean; isIdFetching(state: ReducerType, id: S['RealType'][IdKey]): boolean; isIdInvalidated(state: ReducerType, id: S['RealType'][IdKey]): boolean; }