Skip to content

Commit 8606cc4

Browse files
committed
fix(types): make withCodePush type more flexible
(cherry picked from commit a9fb876)
1 parent ab96e6d commit 8606cc4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/api-js/functions/withCodePush.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Internally, the higher-order component calls `sync` inside its `componentDidMoun
1818

1919
#### P
2020

21-
`P` _extends_ `object`
21+
`P` _extends_ `object` \| `Record`\<`string`, `unknown`\>
2222

2323
### Parameters
2424

@@ -44,7 +44,7 @@ Internally, the higher-order component calls `sync` inside its `componentDidMoun
4444

4545
#### P
4646

47-
`P` _extends_ `object`
47+
`P` _extends_ `object` \| `Record`\<`string`, `unknown`\>
4848

4949
### Parameters
5050

src/CodePush.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export interface CodePushOptions extends SyncOptions {
3030
* @param component the React Component that will be decorated
3131
*/
3232
// @ts-ignore
33-
export function withCodePush<P extends object>(component: React.ComponentType<P>): React.ComponentType;
33+
export function withCodePush<P extends object | Record<string, unknown>>(
34+
component: React.ComponentType<P>,
35+
): React.ComponentType;
3436

3537
/**
3638
* Wraps a React component inside a "higher order" React component that knows how to synchronize your app's JavaScript bundle and image assets when it is mounted.
@@ -39,7 +41,7 @@ export function withCodePush<P extends object>(component: React.ComponentType<P>
3941
*
4042
* @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show a prompt?, install the update immediately?).
4143
*/
42-
export function withCodePush<P extends object>(
44+
export function withCodePush<P extends object | Record<string, unknown>>(
4345
options: CodePushOptions,
4446
): (component: React.ComponentType<P>) => React.ComponentType;
4547

0 commit comments

Comments
 (0)