diff --git a/types/typeUtils.d.ts b/types/typeUtils.d.ts index 1ea2ecd..10fdd73 100644 --- a/types/typeUtils.d.ts +++ b/types/typeUtils.d.ts @@ -70,6 +70,9 @@ type UnionToIntersection = (T extends object ? (k: T) => void : never) extend /** Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. */ type ThisParameterType = T extends (this: infer U, ...args: Array) => any ? U : unknown; +/** Renames the `this` parameter to `self`, this allows passing compiler's noIndexWithoutCall diagnostic */ +type InlineThisParameter = T extends (...args: infer A) => infer R ? (self: any, ...args: A) => R : T; + /** Removes the 'this' parameter from a function type. */ type OmitThisParameter = unknown extends ThisParameterType ? T