@@ -40,7 +40,6 @@ import type {TracingMarkerInstance} from './ReactFiberTracingMarkerComponent';
40
40
import type { TransitionStatus } from './ReactFiberConfig' ;
41
41
import type { Hook } from './ReactFiberHooks' ;
42
42
43
- import checkPropTypes from 'shared/checkPropTypes' ;
44
43
import {
45
44
markComponentRenderStarted ,
46
45
markComponentRenderStopped ,
@@ -401,23 +400,6 @@ function updateForwardRef(
401
400
// TODO: current can be non-null here even if the component
402
401
// hasn't yet mounted. This happens after the first render suspends.
403
402
// We'll need to figure out if this is fine or can cause issues.
404
-
405
- if ( __DEV__ ) {
406
- if ( workInProgress . type !== workInProgress . elementType ) {
407
- // Lazy component props can't be validated in createElement
408
- // because they're only guaranteed to be resolved here.
409
- const innerPropTypes = Component . propTypes ;
410
- if ( innerPropTypes ) {
411
- checkPropTypes (
412
- innerPropTypes ,
413
- nextProps , // Resolved props
414
- 'prop' ,
415
- getComponentNameFromType ( Component ) ,
416
- ) ;
417
- }
418
- }
419
- }
420
-
421
403
const render = Component . render ;
422
404
const ref = workInProgress . ref ;
423
405
@@ -507,17 +489,6 @@ function updateMemoComponent(
507
489
) ;
508
490
}
509
491
if ( __DEV__ ) {
510
- const innerPropTypes = type . propTypes ;
511
- if ( innerPropTypes ) {
512
- // Inner memo component props aren't currently validated in createElement.
513
- // We could move it there, but we'd still need this for lazy code path.
514
- checkPropTypes (
515
- innerPropTypes ,
516
- nextProps , // Resolved props
517
- 'prop' ,
518
- getComponentNameFromType ( type ) ,
519
- ) ;
520
- }
521
492
if ( Component . defaultProps !== undefined ) {
522
493
const componentName = getComponentNameFromType ( type ) || 'Unknown' ;
523
494
if ( ! didWarnAboutDefaultPropsOnFunctionComponent [ componentName ] ) {
@@ -543,20 +514,6 @@ function updateMemoComponent(
543
514
workInProgress . child = child ;
544
515
return child ;
545
516
}
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
- }
560
517
const currentChild = ( ( current . child : any ) : Fiber ) ; // This is always exactly one child
561
518
const hasScheduledUpdateOrContext = checkScheduledUpdateOrContext (
562
519
current ,
@@ -592,37 +549,6 @@ function updateSimpleMemoComponent(
592
549
// TODO: current can be non-null here even if the component
593
550
// hasn't yet mounted. This happens when the inner render suspends.
594
551
// 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
- }
626
552
if ( current !== null ) {
627
553
const prevProps = current . memoizedProps ;
628
554
if (
@@ -1099,22 +1025,6 @@ function updateFunctionComponent(
1099
1025
nextProps : any ,
1100
1026
renderLanes : Lanes ,
1101
1027
) {
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
-
1118
1028
let context ;
1119
1029
if ( ! disableLegacyContext ) {
1120
1030
const unmaskedContext = getUnmaskedContext ( workInProgress , Component , true ) ;
@@ -1253,20 +1163,6 @@ function updateClassComponent(
1253
1163
break ;
1254
1164
}
1255
1165
}
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
- }
1270
1166
}
1271
1167
1272
1168
// Push context providers early to prevent context stack mismatches.
@@ -1815,19 +1711,6 @@ function mountLazyComponent(
1815
1711
return child;
1816
1712
}
1817
1713
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
- }
1831
1714
child = updateMemoComponent (
1832
1715
null ,
1833
1716
workInProgress ,
@@ -3549,11 +3432,6 @@ function updateContextProvider(
3549
3432
) ;
3550
3433
}
3551
3434
}
3552
- const providerPropTypes = workInProgress . type . propTypes ;
3553
-
3554
- if ( providerPropTypes ) {
3555
- checkPropTypes ( providerPropTypes , newProps , 'prop' , 'Context.Provider' ) ;
3556
- }
3557
3435
}
3558
3436
3559
3437
pushProvider ( workInProgress , context , newValue ) ;
@@ -4229,19 +4107,6 @@ function beginWork(
4229
4107
const unresolvedProps = workInProgress . pendingProps ;
4230
4108
// Resolve outer props first, then resolve inner props.
4231
4109
let resolvedProps = resolveDefaultProps ( type , unresolvedProps ) ;
4232
- if ( __DEV__ ) {
4233
- if ( workInProgress . type !== workInProgress . elementType ) {
4234
- const outerPropTypes = type . propTypes ;
4235
- if ( outerPropTypes ) {
4236
- checkPropTypes (
4237
- outerPropTypes ,
4238
- resolvedProps , // Resolved for outer only
4239
- 'prop' ,
4240
- getComponentNameFromType ( type ) ,
4241
- ) ;
4242
- }
4243
- }
4244
- }
4245
4110
resolvedProps = resolveDefaultProps ( type . type , resolvedProps ) ;
4246
4111
return updateMemoComponent (
4247
4112
current ,
0 commit comments