UNPKG

@data-client/rest

Version:

Quickly define typed REST resources and endpoints

14 lines 680 B
import { Schema, schema } from '@data-client/endpoint'; import { ExtractObject } from './extractObject.js'; export default function extractCollection<M extends <C extends schema.Collection>(collection: C) => any, S extends Schema | undefined>(s: S, mapper: M): ExtractCollection<S> | undefined; export type ExtractCollection<S extends Schema | undefined> = S extends ({ push: any; unshift: any; assign: any; schema: Schema; }) ? S : S extends schema.Object<infer T> ? ExtractObject<T> : S extends Exclude<Schema, { [K: string]: any; }> ? never : S extends { [K: string]: Schema; } ? ExtractObject<S> : never; //# sourceMappingURL=extractCollection.d.ts.map