fix(types): allow use PropType with Function (#915)

close #748
This commit is contained in:
Carlos Rodrigues
2020-04-03 14:28:13 +01:00
committed by GitHub
parent 4b03b922e2
commit 026eb729f3
2 changed files with 47 additions and 1 deletions

View File

@@ -39,7 +39,14 @@ interface PropOptions<T = any> {
export type PropType<T> = PropConstructor<T> | PropConstructor<T>[]
type PropConstructor<T = any> = { new (...args: any[]): T & object } | { (): T }
type PropConstructor<T = any> =
| { new (...args: any[]): T & object }
| { (): T }
| PropMethod<T>
type PropMethod<T> = T extends (...args: any) => any // if is function with args
? { new (): T; (): T; readonly proptotype: Function } // Create Function like contructor
: never
type RequiredKeys<T, MakeDefaultRequired> = {
[K in keyof T]: T[K] extends