Skip to content

Commit f8d6edb

Browse files
maitrerobertMinishlink
authored andcommitted
fix: better withCodePush typing (#3)
1 parent 3730763 commit f8d6edb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/CodePush.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ export interface CodePushOptions extends SyncOptions {
2525
* @param component the React Component that will be decorated
2626
*/
2727
// @ts-ignore
28-
export function withCodePush(component: any): React.FunctionComponent;
28+
export function withCodePush<P extends object>(component: React.ComponentType<P>): React.ComponentType;
2929

3030
/**
3131
* Decorates a React Component configuring it to sync for updates with the CodePush server.
3232
*
3333
* @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?).
3434
*/
35-
export function withCodePush(options: CodePushOptions): (component: any) => React.FunctionComponent;
35+
export function withCodePush<P extends object>(
36+
options: CodePushOptions,
37+
): (component: React.ComponentType<P>) => React.ComponentType;
3638

3739
export function withCodePush<P extends object>(optionsOrComponent: CodePushOptions | React.ComponentType<P>) {
3840
const options: CodePushOptions = typeof optionsOrComponent === 'function' ? {} : optionsOrComponent;

0 commit comments

Comments
 (0)