Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 233 Bytes

typescript_tips.md

File metadata and controls

19 lines (15 loc) · 233 Bytes

参数是一个类

// 1
export function foo<T>(
    clazz: new (...args: any[]) => T
): void

// 2
export function foo<T>(
    object: T
): void

class Person {}
const obj = {}

foo(Person, {}) // #1
foo(obj, {}) // #2