mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix ThisParameterType<T> type (#36013)
* Simplify ThisParameterType<T> type * Add tests
This commit is contained in:
Vendored
+1
-1
@@ -298,7 +298,7 @@ declare var Function: FunctionConstructor;
|
||||
/**
|
||||
* Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
|
||||
*/
|
||||
type ThisParameterType<T> = T extends (this: unknown, ...args: any[]) => any ? unknown : T extends (this: infer U, ...args: any[]) => any ? U : unknown;
|
||||
type ThisParameterType<T> = T extends (this: infer U, ...args: any[]) => any ? U : unknown;
|
||||
|
||||
/**
|
||||
* Removes the 'this' parameter from a function type.
|
||||
|
||||
Reference in New Issue
Block a user