UNPKG

560 BTypeScriptView Raw
1import { Class } from './Class';
2/**
3 * Get the instance type of a `class` from a class object
4 * @param C * *typeof** class
5 * @returns [[Object]]
6 * @example
7 * ```ts
8 * import {C} from 'ts-toolbelt'
9 *
10 * /// `create` takes an instance constructor and creates an instance of it
11 * declare function create<C extends (new (...args: any[]) => any)>(c: C): C.InstanceOf<C>
12 *
13 * class A {}
14 * class B {}
15 *
16 * let a = create(A) // A
17 * let b = create(B) // B
18 * ```
19 */
20export declare type Instance<C extends Class> = C extends Class<any[], infer R> ? R : any;