@@ -68,6 +68,7 @@ type WaitForOptions = {
6868 interval ?: number ,
6969 onTimeout ?: ( error : mixed ) => Error ,
7070} ;
71+
7172type WaitForFunction = < T = any > (
7273 expectation: () => T ,
7374 options ? : WaitForOptions
@@ -289,11 +290,6 @@ interface Thenable {
289290 then : ( resolve : ( ) = > any , reject ? : ( ) => any ) = > any ;
290291}
291292
292- interface RenderOptions {
293- wrapper ?: React . ComponentType < any > ;
294- createNodeMock ?: ( element : React . Element < any > ) => any ;
295- }
296-
297293type Debug = {
298294 ( message ? : string ) : void ,
299295 shallow : ( message ? : string ) => void ,
@@ -307,15 +303,6 @@ type Queries = ByTextQueries &
307303 UnsafeByPropsQueries &
308304 A11yAPI ;
309305
310- interface RenderAPI extends Queries {
311- update ( nextElement : React . Element < any > ) : void ;
312- rerender ( nextElement : React . Element < any > ) : void ;
313- unmount ( nextElement ?: React . Element < any > ) : void ;
314- toJSON ( ) : ReactTestRendererJSON [ ] | ReactTestRendererJSON | null ;
315- debug : Debug ;
316- container : ReactTestInstance ;
317- }
318-
319306type FireEventFunction = (
320307 element : ReactTestInstance ,
321308 eventName : string ,
@@ -328,24 +315,29 @@ type FireEventAPI = FireEventFunction & {
328315 scroll : ( element : ReactTestInstance , ...data : Array < any > ) => any ,
329316} ;
330317
331- type RenderHookResult < Result , Props > = {
332- rerender : ( props : Props ) => void ,
333- result : { current : Result } ,
334- unmount : ( ) => void ,
335- } ;
336-
337- type RenderHookOptions < Props > = {
338- initialProps ?: Props ,
339- wrapper ?: React . ComponentType < any > ,
340- } ;
341-
342318declare module '@testing-library/react-native' {
319+ declare interface RenderResult extends Queries {
320+ update ( nextElement : React . Element < any > ) : void ;
321+ rerender ( nextElement : React . Element < any > ) : void ;
322+ unmount ( nextElement ?: React . Element < any > ) : void ;
323+ toJSON ( ) : ReactTestRendererJSON [ ] | ReactTestRendererJSON | null ;
324+ debug : Debug ;
325+ container : ReactTestInstance ;
326+ }
327+
328+ declare type RenderAPI = RenderResult ;
329+
330+ declare interface RenderOptions {
331+ wrapper ?: React . ComponentType < any > ;
332+ createNodeMock ?: ( element : React . Element < any > ) => any ;
333+ }
334+
343335 declare export var render : (
344336 component : React . Element < any > ,
345337 options ? : RenderOptions
346- ) = > RenderAPI ;
338+ ) = > RenderResult ;
347339
348- declare export var screen : RenderAPI ;
340+ declare export var screen : RenderResult ;
349341
350342 declare export var cleanup : ( ) = > void ;
351343 declare export var fireEvent : FireEventAPI ;
@@ -369,6 +361,17 @@ declare module '@testing-library/react-native' {
369361 normalizerConfig ? : NormalizerConfig
370362 ) = > NormalizerFn ;
371363
364+ declare type RenderHookResult < Result , Props > = {
365+ rerender : ( props : Props ) => void ,
366+ result : { current : Result } ,
367+ unmount : ( ) => void ,
368+ } ;
369+
370+ declare type RenderHookOptions < Props > = {
371+ initialProps ?: Props ,
372+ wrapper ?: React . ComponentType < any > ,
373+ } ;
374+
372375 declare type RenderHookFunction = < Result , Props > (
373376 renderCallback : ( props : Props ) = > Result ,
374377 options ?: RenderHookOptions < Props >
0 commit comments