Skip to content

Commit 2b36511

Browse files
authored
fix: correct TS typings for debug.shallow (#584)
1 parent 6c40fba commit 2b36511

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

typings/__tests__/index.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ const findAllBy: Promise<ReactTestInstance[]>[] = [
199199
// debug API
200200
const debugFn = tree.debug();
201201
const debugFnWithMessage = tree.debug('my message');
202+
const shallowDebug = tree.debug.shallow();
203+
const shallowDebugWithMessage = tree.debug.shallow('my message');
202204

203205
// update API
204206
tree.update(<View />);

typings/index.d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ interface FindByAPI {
137137
value: string | RegExp,
138138
waitForOptions?: WaitForOptions
139139
) => FindReturn;
140-
findByTestId: (testID: string | RegExp, waitForOptions?: WaitForOptions) => FindReturn;
140+
findByTestId: (
141+
testID: string | RegExp,
142+
waitForOptions?: WaitForOptions
143+
) => FindReturn;
141144
findAllByText: (
142145
text: string | RegExp,
143146
waitForOptions?: WaitForOptions
@@ -295,14 +298,19 @@ export interface RenderOptions {
295298
createNodeMock?: (element: React.ReactElement<any>) => any;
296299
}
297300

301+
type Debug = {
302+
(message?: string);
303+
shallow: (message?: string) => void;
304+
};
305+
298306
type Queries = GetByAPI & QueryByAPI & FindByAPI & A11yAPI;
299307

300308
export interface RenderAPI extends Queries {
301309
update(nextElement: React.ReactElement<any>): void;
302310
rerender(nextElement: React.ReactElement<any>): void;
303311
unmount(nextElement?: React.ReactElement<any>): void;
304312
toJSON(): ReactTestRendererJSON | null;
305-
debug(message?: string): void;
313+
debug: Debug;
306314
container: ReactTestInstance;
307315
}
308316

0 commit comments

Comments
 (0)