-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Type for options in autodetected renderer was incorrectly inferr…
…ing any passed type Changed `renderHook` in `ReactHooksRenderer` type to not use a generic for options but rather the react specific `RendererOptions`. Moved `ReactHooksRenderer` into react specific types as all auto-detected renders are react renderers. All modules are currently exporting both the shared types and the react types so this a non-breaking change.
- Loading branch information
Showing
5 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import { ComponentType } from 'react' | ||
|
||
import { RenderHook, RenderHookOptions, Act } from '.' | ||
|
||
export type WrapperComponent<TProps> = ComponentType<TProps> | ||
|
||
export type RendererOptions<TProps> = { | ||
wrapper?: WrapperComponent<TProps> | ||
} | ||
|
||
export interface ReactHooksRenderer { | ||
renderHook: <TProps, TResult>( | ||
callback: (props: TProps) => TResult, | ||
options?: RenderHookOptions<TProps, RendererOptions<TProps>> | ||
) => RenderHook<TProps, TResult> | ||
act: Act | ||
cleanup: () => void | ||
addCleanup: (callback: () => Promise<void> | void) => () => void | ||
removeCleanup: (callback: () => Promise<void> | void) => void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters