UNPKG

cooky-cutter

Version:

Object factories for testing in TypeScript

13 lines (12 loc) 871 B
import { DerivedFunction } from "./derive"; import { Factory, AttributeFunction } from "./define"; import { ArrayFactoryPassThrough } from "./array"; declare function isDerivedFunction<Base, Output>(fn: any): fn is DerivedFunction<Base, Output>; declare function isFactoryFunction<Base>(fn: any): fn is Factory<Base>; declare function isArrayFactoryFunction<Base>(fn: any): fn is ArrayFactoryPassThrough<Base>; declare function isAttributeFunction<T>(fn: any): fn is AttributeFunction<T>; declare type Keys<T> = keyof T; declare type Diff<T, U> = T extends U ? never : T; declare type DiffProperties<T, U> = Pick<T, Diff<Keys<T>, Keys<U>>>; export declare type ArrayElement<ArrayType> = ArrayType extends ReadonlyArray<infer ElementType> ? ElementType : never; export { isAttributeFunction, isDerivedFunction, isFactoryFunction, isArrayFactoryFunction, DiffProperties };