1
- import type { ReactElement , ReactNode } from 'react' ;
2
- import React , { Fragment } from 'react' ;
1
+ import React , { Fragment , ReactElement , ReactNode } from 'react' ;
3
2
import {
4
3
ForwardRef ,
5
4
isContextConsumer ,
@@ -106,7 +105,7 @@ const onlyMeaningfulChildren = (children: ReactNode): boolean =>
106
105
children !== '' ;
107
106
108
107
const filterProps = (
109
- originalProps : Record < string , any > ,
108
+ originalProps : Record < string , unknown > ,
110
109
cb : ( propsValue : any , propsName : string ) => boolean
111
110
) : Record < string , any > => {
112
111
const filteredProps : Record < string , any > = { } ;
@@ -139,6 +138,7 @@ const parseReactElement = (
139
138
}
140
139
141
140
const displayName = displayNameFn ( element ) ;
141
+ // @ts -expect-error: flow to TS
142
142
const props = filterProps ( element . props , noChildren ) ;
143
143
144
144
// @ts -expect-error: flow to TS
@@ -156,9 +156,11 @@ const parseReactElement = (
156
156
157
157
// @ts -expect-error: flow to TS
158
158
const defaultProps = filterProps ( element . type . defaultProps || { } , noChildren ) ;
159
+ // @ts -expect-error: flow to TS
159
160
const children = React . Children . toArray ( element . props . children )
160
161
. filter ( onlyMeaningfulChildren )
161
- . map ( ( child : ReactElement < any > ) => parseReactElement ( child , options ) ) ;
162
+ // @ts -expect-error: flow to TS
163
+ . map ( ( child : ReactNode ) => parseReactElement ( child , options ) ) ;
162
164
163
165
if ( supportFragment && element . type === Fragment ) {
164
166
return createReactFragmentTreeNode ( key , children ) ;
0 commit comments