Skip to content

Commit

Permalink
fix(jest-mock): added missing overload call signature (#15183)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rajat19 authored Jul 23, 2024
1 parent 798d6c0 commit c5a00aa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/jest-mock/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ export class ModuleMocker {
metadata: MockMetadata<T, 'function'>,
restore?: () => void,
): Mock<T>;
private _makeComponent<T>(
metadata: MockMetadata<T>,
restore?: () => void,
): Record<string, any>;
/* eslint-enable @typescript-eslint/unified-signatures */
private _makeComponent<T extends UnknownFunction>(
metadata: MockMetadata<T>,
Expand Down Expand Up @@ -927,9 +931,6 @@ export class ModuleMocker {
Record<string, any> | Array<unknown> | RegExp | T | Mock | undefined
>,
): Mocked<T> {
// metadata not compatible but it's the same type, maybe problem with
// overloading of _makeComponent and not _generateMock?
// @ts-expect-error - unsure why TSC complains here?
const mock = this._makeComponent(metadata);
if (metadata.refID != null) {
refs[metadata.refID] = mock;
Expand Down

0 comments on commit c5a00aa

Please sign in to comment.