Skip to content

Commit

Permalink
fix: 🐛 mock.ts SpyObject type
Browse files Browse the repository at this point in the history
Type 'R' does not satisfy the constraint 'FunctionLike'.ts(2344)
This type parameter might need an `extends FunctionLike` constraint.
  • Loading branch information
chimurai committed Apr 15, 2023
1 parent b96db66 commit 4fc8e24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion projects/spectator/jest/src/lib/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { FactoryProvider, AbstractType, Type } from '@angular/core';
import { installProtoMethods, CompatibleSpy, SpyObject as BaseSpyObject } from '@ngneat/spectator';
import { jest } from '@jest/globals';

export type SpyObject<T> = BaseSpyObject<T> & { [P in keyof T]: T[P] & (T[P] extends (...args: any[]) => infer R ? jest.Mock<R> : T[P]) };
export type SpyObject<T> = BaseSpyObject<T> &
{ [P in keyof T]: T[P] & (T[P] extends (...args: any[]) => infer R ? (R extends (...args: any[]) => any ? jest.Mock<R> : T[P]) : T[P]) };

/**
* @publicApi
Expand Down

0 comments on commit 4fc8e24

Please sign in to comment.