Skip to main content
Module

x/ts_toolbelt_unofficial/mod.ts>Class.Instance

👷 TypeScript's largest type utility library, now on Deno
Latest
type alias Class.Instance
import { type Class } from "https://deno.land/x/ts_toolbelt_unofficial@1.1.0/mod.ts";
const { Instance } = Class;

Get the instance type of a class from a class object

Examples

Example 1

import {C} from 'ts-toolbelt.ts'

/// `create` takes an instance constructor and creates an instance of it
declare function create<C extends (new (...args: any[]) => any)>(c: C): C.InstanceOf<C>

class A {}
class B {}

let a = create(A) // A
let b = create(B) // B
definition: C extends Class<any[], infer R> ? R : any