@data-client/normalizr
Version:
Normalizes and denormalizes JSON according to schema for Redux and Flux applications
9 lines (8 loc) • 583 B
TypeScript
import { FetchFunction } from './types.js';
import { Schema } from '../interface.js';
import { Denormalize } from '../types.js';
/** What the function's promise resolves to */
export type ResolveType<E extends (...args: any) => any> = ReturnType<E> extends Promise<infer R> ? R : never;
/** Fallback to schema if fetch function isn't defined */
export type InferReturn<F extends FetchFunction, S extends Schema | undefined> = S extends undefined ? ReturnType<F> : ReturnType<F> extends unknown ? Promise<Denormalize<S>> : ReturnType<F>;
//# sourceMappingURL=utility.d.ts.map