FakeOf beta
TypeAlias of @v12-engine/client/testing
ts
export type FakeOf<T> = {
[K in keyof T]?: NonNullable<T[K]> extends (...args: infer A) => unknown ? {
fake(...args: A): unknown;
}['fake'] : NonNullable<T[K]> extends object ? FakeOf<NonNullable<T[K]>> | T[K] : T[K];
};What a test gives a fake of T: any of its members, each as far as the test needs it. A function takes what T's takes, or less of it (a method's), and gives back what the test wants (a mesh of the two fields the code reads); an object is a fake of its own, or the real one. A name T does not have is an error, as is an argument of another type