Skip to content

Commit

Permalink
[enzyme] Use Parameters type
Browse files Browse the repository at this point in the history
  • Loading branch information
screendriver committed Feb 19, 2019
1 parent 56e7974 commit 8b50aa7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion types/enzyme/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
length: number;
}

type Parameters<T> = T extends (...args: infer A) => any ? A : never

// tslint:disable-next-line no-empty-interface
export interface ShallowWrapper<P = {}, S = {}, C = Component> extends CommonWrapper<P, S, C> { }
export class ShallowWrapper<P = {}, S = {}, C = Component> {
Expand Down Expand Up @@ -452,7 +454,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
/**
* Returns a wrapper of the node rendered by the provided render prop.
*/
renderProp<PropName extends keyof P>(prop: PropName): (...params: any[]) => ShallowWrapper<P, S>;
renderProp<PropName extends keyof P>(prop: PropName): (...params: Parameters<P[PropName]>) => ShallowWrapper<any, never>;
}

// tslint:disable-next-line no-empty-interface
Expand Down

0 comments on commit 8b50aa7

Please sign in to comment.