Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ type NonNullable<T> = T & {};
/**
* Obtain the parameters of a function type in a tuple
*/
type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
type Parameters<T extends AnyFunction> = T extends (...args: infer P) => any ? P : never;

/**
* Obtain the parameters of a constructor function type in a tuple
Expand All @@ -1622,7 +1622,7 @@ type ConstructorParameters<T extends abstract new (...args: any) => any> = T ext
/**
* Obtain the return type of a function type
*/
type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
type ReturnType<T extends AnyFunction> = T extends (...args: any) => infer R ? R : any;

/**
* Obtain the return type of a constructor function type
Expand Down Expand Up @@ -1654,6 +1654,11 @@ type Uncapitalize<S extends string> = intrinsic;
*/
type NoInfer<T> = intrinsic;

/**
* A wrapper for a function with any amount of arguments and any return value.
*/
type AnyFunction = (...args: any[]) => any;

/**
* Marker for contextual 'this' type
*/
Expand Down
Loading
Loading