Skip to content

Commit ba95cf4

Browse files
authored
Remove propTypes on instance warning (#30296)
`propTypes` are no longer supported at all in React 19, remove this outdated warning.
1 parent c3cdbec commit ba95cf4

File tree

5 files changed

+0
-20
lines changed

5 files changed

+0
-20
lines changed

packages/react-reconciler/src/ReactFiberClassComponent.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,6 @@ function checkClassInstance(workInProgress: Fiber, ctor: any, newProps: any) {
376376
name,
377377
);
378378
}
379-
if (instance.propTypes) {
380-
console.error(
381-
'propTypes was defined as an instance property on %s. Use a static ' +
382-
'property to define propTypes instead.',
383-
name,
384-
);
385-
}
386379
if (instance.contextType) {
387380
console.error(
388381
'contextType was defined as an instance property on %s. Use a static ' +

packages/react-server/src/ReactFizzClassComponent.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,6 @@ function checkClassInstance(instance: any, ctor: any, newProps: any) {
353353
name,
354354
);
355355
}
356-
if (instance.propTypes) {
357-
console.error(
358-
'propTypes was defined as an instance property on %s. Use a static ' +
359-
'property to define propTypes instead.',
360-
name,
361-
);
362-
}
363356
if (instance.contextType) {
364357
console.error(
365358
'contextType was defined as an instance property on %s. Use a static ' +

packages/react/src/__tests__/ReactCoffeeScriptClass-test.coffee

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ describe 'ReactCoffeeScriptClass', ->
411411
constructor: ->
412412
@contextTypes = {}
413413
@contextType = {}
414-
@propTypes = {}
415414

416415
getInitialState: ->
417416
getInitialStateWasCalled = true
@@ -431,7 +430,6 @@ describe 'ReactCoffeeScriptClass', ->
431430
).toErrorDev([
432431
'getInitialState was defined on Foo, a plain JavaScript class.',
433432
'getDefaultProps was defined on Foo, a plain JavaScript class.',
434-
'propTypes was defined as an instance property on Foo.',
435433
'contextTypes was defined as an instance property on Foo.',
436434
'contextType was defined as an instance property on Foo.',
437435
])

packages/react/src/__tests__/ReactES6Class-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ describe('ReactES6Class', () => {
459459
super();
460460
this.contextTypes = {};
461461
this.contextType = {};
462-
this.propTypes = {};
463462
}
464463
getInitialState() {
465464
getInitialStateWasCalled = true;
@@ -477,7 +476,6 @@ describe('ReactES6Class', () => {
477476
expect(() => runTest(<Foo />, 'SPAN', 'foo')).toErrorDev([
478477
'getInitialState was defined on Foo, a plain JavaScript class.',
479478
'getDefaultProps was defined on Foo, a plain JavaScript class.',
480-
'propTypes was defined as an instance property on Foo.',
481479
'contextType was defined as an instance property on Foo.',
482480
'contextTypes was defined as an instance property on Foo.',
483481
]);

packages/react/src/__tests__/ReactTypeScriptClass-test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ let getDefaultPropsWasCalled = false;
244244
class ClassicProperties extends React.Component {
245245
contextTypes = {};
246246
contextType = {};
247-
propTypes = {};
248247
getDefaultProps() {
249248
getDefaultPropsWasCalled = true;
250249
return {};
@@ -612,7 +611,6 @@ describe('ReactTypeScriptClass', function() {
612611
'a plain JavaScript class.',
613612
'getDefaultProps was defined on ClassicProperties, ' +
614613
'a plain JavaScript class.',
615-
'propTypes was defined as an instance property on ClassicProperties.',
616614
'contextTypes was defined as an instance property on ClassicProperties.',
617615
'contextType was defined as an instance property on ClassicProperties.',
618616
]);

0 commit comments

Comments
 (0)