@@ -401,22 +401,6 @@ function updateForwardRef(
401401 // hasn't yet mounted. This happens after the first render suspends.
402402 // We'll need to figure out if this is fine or can cause issues.
403403
404- if ( __DEV__ ) {
405- if ( workInProgress . type !== workInProgress . elementType ) {
406- // Lazy component props can't be validated in createElement
407- // because they're only guaranteed to be resolved here.
408- const innerPropTypes = Component . propTypes ;
409- if ( innerPropTypes ) {
410- checkPropTypes (
411- innerPropTypes ,
412- nextProps , // Resolved props
413- 'prop' ,
414- getComponentNameFromType ( Component ) ,
415- ) ;
416- }
417- }
418- }
419-
420404 const render = Component . render ;
421405 const ref = workInProgress . ref ;
422406
@@ -506,17 +490,6 @@ function updateMemoComponent(
506490 ) ;
507491 }
508492 if ( __DEV__ ) {
509- const innerPropTypes = type . propTypes ;
510- if ( innerPropTypes ) {
511- // Inner memo component props aren't currently validated in createElement.
512- // We could move it there, but we'd still need this for lazy code path.
513- checkPropTypes (
514- innerPropTypes ,
515- nextProps , // Resolved props
516- 'prop' ,
517- getComponentNameFromType ( type ) ,
518- ) ;
519- }
520493 if ( Component . defaultProps !== undefined ) {
521494 const componentName = getComponentNameFromType ( type ) || 'Unknown' ;
522495 if ( ! didWarnAboutDefaultPropsOnFunctionComponent [ componentName ] ) {
@@ -543,20 +516,6 @@ function updateMemoComponent(
543516 workInProgress . child = child ;
544517 return child ;
545518 }
546- if ( __DEV__ ) {
547- const type = Component . type ;
548- const innerPropTypes = type . propTypes ;
549- if ( innerPropTypes ) {
550- // Inner memo component props aren't currently validated in createElement.
551- // We could move it there, but we'd still need this for lazy code path.
552- checkPropTypes (
553- innerPropTypes ,
554- nextProps , // Resolved props
555- 'prop' ,
556- getComponentNameFromType ( type ) ,
557- ) ;
558- }
559- }
560519 const currentChild = ( ( current . child : any ) : Fiber ) ; // This is always exactly one child
561520 const hasScheduledUpdateOrContext = checkScheduledUpdateOrContext (
562521 current ,
@@ -592,37 +551,6 @@ function updateSimpleMemoComponent(
592551 // TODO: current can be non-null here even if the component
593552 // hasn't yet mounted. This happens when the inner render suspends.
594553 // We'll need to figure out if this is fine or can cause issues.
595-
596- if ( __DEV__ ) {
597- if ( workInProgress . type !== workInProgress . elementType ) {
598- // Lazy component props can't be validated in createElement
599- // because they're only guaranteed to be resolved here.
600- let outerMemoType = workInProgress . elementType ;
601- if ( outerMemoType . $$typeof === REACT_LAZY_TYPE ) {
602- // We warn when you define propTypes on lazy()
603- // so let's just skip over it to find memo() outer wrapper.
604- // Inner props for memo are validated later.
605- const lazyComponent : LazyComponentType < any , any > = outerMemoType ;
606- const payload = lazyComponent . _payload ;
607- const init = lazyComponent . _init ;
608- try {
609- outerMemoType = init ( payload ) ;
610- } catch ( x ) {
611- outerMemoType = null ;
612- }
613- // Inner propTypes will be validated in the function component path.
614- const outerPropTypes = outerMemoType && ( outerMemoType : any ) . propTypes ;
615- if ( outerPropTypes ) {
616- checkPropTypes (
617- outerPropTypes ,
618- nextProps , // Resolved (SimpleMemoComponent has no defaultProps)
619- 'prop' ,
620- getComponentNameFromType ( outerMemoType ) ,
621- ) ;
622- }
623- }
624- }
625- }
626554 if ( current !== null ) {
627555 const prevProps = current . memoizedProps ;
628556 if (
@@ -1099,22 +1027,6 @@ function updateFunctionComponent(
10991027 nextProps : any ,
11001028 renderLanes : Lanes ,
11011029) {
1102- if ( __DEV__ ) {
1103- if ( workInProgress . type !== workInProgress . elementType ) {
1104- // Lazy component props can't be validated in createElement
1105- // because they're only guaranteed to be resolved here.
1106- const innerPropTypes = Component . propTypes ;
1107- if ( innerPropTypes ) {
1108- checkPropTypes (
1109- innerPropTypes ,
1110- nextProps , // Resolved props
1111- 'prop' ,
1112- getComponentNameFromType ( Component ) ,
1113- ) ;
1114- }
1115- }
1116- }
1117-
11181030 let context ;
11191031 if ( ! disableLegacyContext ) {
11201032 const unmaskedContext = getUnmaskedContext ( workInProgress , Component , true ) ;
@@ -1253,20 +1165,6 @@ function updateClassComponent(
12531165 break ;
12541166 }
12551167 }
1256-
1257- if ( workInProgress . type !== workInProgress . elementType ) {
1258- // Lazy component props can't be validated in createElement
1259- // because they're only guaranteed to be resolved here.
1260- const innerPropTypes = Component . propTypes ;
1261- if ( innerPropTypes ) {
1262- checkPropTypes (
1263- innerPropTypes ,
1264- nextProps , // Resolved props
1265- 'prop' ,
1266- getComponentNameFromType ( Component ) ,
1267- ) ;
1268- }
1269- }
12701168 }
12711169
12721170 // Push context providers early to prevent context stack mismatches.
@@ -1815,19 +1713,6 @@ function mountLazyComponent(
18151713 return child;
18161714 }
18171715 case MemoComponent : {
1818- if ( __DEV__ ) {
1819- if ( workInProgress . type !== workInProgress . elementType ) {
1820- const outerPropTypes = Component . propTypes ;
1821- if ( outerPropTypes ) {
1822- checkPropTypes (
1823- outerPropTypes ,
1824- resolvedProps , // Resolved for outer only
1825- 'prop' ,
1826- getComponentNameFromType ( Component ) ,
1827- ) ;
1828- }
1829- }
1830- }
18311716 child = updateMemoComponent (
18321717 null ,
18331718 workInProgress ,
@@ -4237,19 +4122,6 @@ function beginWork(
42374122 const unresolvedProps = workInProgress . pendingProps ;
42384123 // Resolve outer props first, then resolve inner props.
42394124 let resolvedProps = resolveDefaultProps ( type , unresolvedProps ) ;
4240- if ( __DEV__ ) {
4241- if ( workInProgress . type !== workInProgress . elementType ) {
4242- const outerPropTypes = type . propTypes ;
4243- if ( outerPropTypes ) {
4244- checkPropTypes (
4245- outerPropTypes ,
4246- resolvedProps , // Resolved for outer only
4247- 'prop' ,
4248- getComponentNameFromType ( type ) ,
4249- ) ;
4250- }
4251- }
4252- }
42534125 resolvedProps = resolveDefaultProps ( type . type , resolvedProps ) ;
42544126 return updateMemoComponent (
42554127 current ,
0 commit comments