@@ -29,17 +29,17 @@ export type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>;
2929
3030export class ElementClass extends Component < any , any > { }
3131
32- /* These are purposefully stripped down versions of React.ComponentClass and React.StatelessComponent .
32+ /* These are purposefully stripped down versions of React.ComponentClass and React.FunctionComponent .
3333 * The optional static properties on them break overload ordering for wrapper methods if they're not
3434 * all specified in the implementation. TS chooses the EnzymePropSelector overload and loses the generics
3535 */
3636export interface ComponentClass < Props > {
3737 new ( props : Props , context ?: any ) : Component < Props > ;
3838}
3939
40- export type StatelessComponent < Props > = ( props : Props , context ?: any ) => JSX . Element | null ;
40+ export type FunctionComponent < Props > = ( props : Props , context ?: any ) => JSX . Element | null ;
4141
42- export type ComponentType < Props > = ComponentClass < Props > | StatelessComponent < Props > ;
42+ export type ComponentType < Props > = ComponentClass < Props > | FunctionComponent < Props > ;
4343
4444/**
4545 * Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the
@@ -54,7 +54,7 @@ export type ComponentType<Props> = ComponentClass<Props> | StatelessComponent<Pr
5454export interface EnzymePropSelector {
5555 [ key : string ] : any ;
5656}
57- export type EnzymeSelector = string | StatelessComponent < any > | ComponentClass < any > | EnzymePropSelector ;
57+ export type EnzymeSelector = string | FunctionComponent < any > | ComponentClass < any > | EnzymePropSelector ;
5858
5959export type Intercepter < T > = ( intercepter : T ) => void ;
6060
@@ -389,7 +389,7 @@ export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
389389 *
390390 * Note: can only be called on a wrapper of a single node.
391391 */
392- type ( ) : string | ComponentClass < P > | StatelessComponent < P > ;
392+ type ( ) : string | ComponentClass < P > | FunctionComponent < P > ;
393393
394394 length : number ;
395395}
@@ -406,7 +406,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
406406 * Find every node in the render tree that matches the provided selector.
407407 * @param selector The selector to match.
408408 */
409- find < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ShallowWrapper < P2 , never > ;
409+ find < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ShallowWrapper < P2 , never > ;
410410 find < P2 > ( component : ComponentType < P2 > ) : ShallowWrapper < P2 , any > ;
411411 find < C2 extends Component > (
412412 componentClass : ComponentClass < C2 [ 'props' ] > ,
@@ -418,7 +418,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
418418 * Removes nodes in the current wrapper that do not match the provided selector.
419419 * @param selector The selector to match.
420420 */
421- filter < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ShallowWrapper < P2 , never > ;
421+ filter < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ShallowWrapper < P2 , never > ;
422422 filter < P2 > ( component : ComponentType < P2 > ) : ShallowWrapper < P2 , any > ;
423423 filter ( props : EnzymePropSelector | string ) : ShallowWrapper < P , S > ;
424424
@@ -431,7 +431,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
431431 * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
432432 * can be provided and it will filter the children by this selector.
433433 */
434- children < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ShallowWrapper < P2 , never > ;
434+ children < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ShallowWrapper < P2 , never > ;
435435 children < P2 > ( component : ComponentType < P2 > ) : ShallowWrapper < P2 , any > ;
436436 children ( selector : string ) : ShallowWrapper < HTMLAttributes , any > ;
437437 children ( props ?: EnzymePropSelector ) : ShallowWrapper < any , any > ;
@@ -466,7 +466,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
466466 *
467467 * Note: can only be called on a wrapper of a single node.
468468 */
469- parents < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ShallowWrapper < P2 , never > ;
469+ parents < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ShallowWrapper < P2 , never > ;
470470 parents < P2 > ( component : ComponentType < P2 > ) : ShallowWrapper < P2 , any > ;
471471 parents ( selector : string ) : ShallowWrapper < HTMLAttributes , any > ;
472472 parents ( props ?: EnzymePropSelector ) : ShallowWrapper < any , any > ;
@@ -477,7 +477,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
477477 *
478478 * Note: can only be called on a wrapper of a single node.
479479 */
480- closest < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ShallowWrapper < P2 , never > ;
480+ closest < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ShallowWrapper < P2 , never > ;
481481 closest < P2 > ( component : ComponentType < P2 > ) : ShallowWrapper < P2 , any > ;
482482 closest ( props : EnzymePropSelector ) : ShallowWrapper < any , any > ;
483483 closest ( selector : string ) : ShallowWrapper < HTMLAttributes , any > ;
@@ -541,7 +541,7 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
541541 * Find every node in the render tree that matches the provided selector.
542542 * @param selector The selector to match.
543543 */
544- find < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ReactWrapper < P2 , never > ;
544+ find < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ReactWrapper < P2 , never > ;
545545 find < P2 > ( component : ComponentType < P2 > ) : ReactWrapper < P2 , any > ;
546546 find < C2 extends Component > ( componentClass : ComponentClass < C2 [ 'props' ] > ) : ReactWrapper < C2 [ 'props' ] , C2 [ 'state' ] , C2 > ;
547547 find ( props : EnzymePropSelector ) : ReactWrapper < any , any > ;
@@ -556,15 +556,15 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
556556 * Removes nodes in the current wrapper that do not match the provided selector.
557557 * @param selector The selector to match.
558558 */
559- filter < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ReactWrapper < P2 , never > ;
559+ filter < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ReactWrapper < P2 , never > ;
560560 filter < P2 > ( component : ComponentType < P2 > ) : ReactWrapper < P2 , any > ;
561561 filter ( props : EnzymePropSelector | string ) : ReactWrapper < P , S > ;
562562
563563 /**
564564 * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
565565 * can be provided and it will filter the children by this selector.
566566 */
567- children < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ReactWrapper < P2 , never > ;
567+ children < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ReactWrapper < P2 , never > ;
568568 children < P2 > ( component : ComponentType < P2 > ) : ReactWrapper < P2 , any > ;
569569 children ( selector : string ) : ReactWrapper < HTMLAttributes , any > ;
570570 children ( props ?: EnzymePropSelector ) : ReactWrapper < any , any > ;
@@ -581,7 +581,7 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
581581 *
582582 * Note: can only be called on a wrapper of a single node.
583583 */
584- parents < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ReactWrapper < P2 , never > ;
584+ parents < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ReactWrapper < P2 , never > ;
585585 parents < P2 > ( component : ComponentType < P2 > ) : ReactWrapper < P2 , any > ;
586586 parents ( selector : string ) : ReactWrapper < HTMLAttributes , any > ;
587587 parents ( props ?: EnzymePropSelector ) : ReactWrapper < any , any > ;
@@ -592,7 +592,7 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
592592 *
593593 * Note: can only be called on a wrapper of a single node.
594594 */
595- closest < P2 > ( statelessComponent : StatelessComponent < P2 > ) : ReactWrapper < P2 , never > ;
595+ closest < P2 > ( statelessComponent : FunctionComponent < P2 > ) : ReactWrapper < P2 , never > ;
596596 closest < P2 > ( component : ComponentType < P2 > ) : ReactWrapper < P2 , any > ;
597597 closest ( props : EnzymePropSelector ) : ReactWrapper < any , any > ;
598598 closest ( selector : string ) : ReactWrapper < HTMLAttributes , any > ;
0 commit comments