@samitouri / QOS-React / commits / ba95cf4b8f

Remove propTypes on instance warning (#30296)

`propTypes` are no longer supported at all in React 19, remove this outdated warning.

Jan Kassens committed Jul 9, 2024 at 13:29 UTC ba95cf4b8f39acfd7c0ccf2795a19430d35ea6b3
5 files changed -20
packages/react-reconciler/src/ReactFiberClassComponent.js
-7
@@ -376,13 +376,6 @@ function checkClassInstance(workInProgress: Fiber, ctor: any, newProps: any) {
376 name,
377 );
378 }
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 - }
379 if (instance.contextType) {
380 console.error(
381 'contextType was defined as an instance property on %s. Use a static ' +
packages/react-server/src/ReactFizzClassComponent.js
-7
@@ -353,13 +353,6 @@ function checkClassInstance(instance: any, ctor: any, newProps: any) {
353 name,
354 );
355 }
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 - }
356 if (instance.contextType) {
357 console.error(
358 'contextType was defined as an instance property on %s. Use a static ' +
packages/react/src/__tests__/ReactCoffeeScriptClass-test.coffee
-2
@@ -411,7 +411,6 @@ describe 'ReactCoffeeScriptClass', ->
411 constructor: ->
412 @contextTypes = {}
413 @contextType = {}
414 - @propTypes = {}
414
415 getInitialState: ->
416 getInitialStateWasCalled = true
@@ -431,7 +430,6 @@ describe 'ReactCoffeeScriptClass', ->
430 ).toErrorDev([
431 'getInitialState was defined on Foo, a plain JavaScript class.',
432 'getDefaultProps was defined on Foo, a plain JavaScript class.',
434 - 'propTypes was defined as an instance property on Foo.',
433 'contextTypes was defined as an instance property on Foo.',
434 'contextType was defined as an instance property on Foo.',
435 ])
packages/react/src/__tests__/ReactES6Class-test.js
-2
@@ -459,7 +459,6 @@ describe('ReactES6Class', () => {
459 super();
460 this.contextTypes = {};
461 this.contextType = {};
462 - this.propTypes = {};
462 }
463 getInitialState() {
464 getInitialStateWasCalled = true;
@@ -477,7 +476,6 @@ describe('ReactES6Class', () => {
476 expect(() => runTest(<Foo />, 'SPAN', 'foo')).toErrorDev([
477 'getInitialState was defined on Foo, a plain JavaScript class.',
478 'getDefaultProps was defined on Foo, a plain JavaScript class.',
480 - 'propTypes was defined as an instance property on Foo.',
479 'contextType was defined as an instance property on Foo.',
480 'contextTypes was defined as an instance property on Foo.',
481 ]);
packages/react/src/__tests__/ReactTypeScriptClass-test.ts
-2
@@ -244,7 +244,6 @@ let getDefaultPropsWasCalled = false;
244 class ClassicProperties extends React.Component {
245 contextTypes = {};
246 contextType = {};
247 - propTypes = {};
247 getDefaultProps() {
248 getDefaultPropsWasCalled = true;
249 return {};
@@ -612,7 +611,6 @@ describe('ReactTypeScriptClass', function() {
611 'a plain JavaScript class.',
612 'getDefaultProps was defined on ClassicProperties, ' +
613 'a plain JavaScript class.',
615 - 'propTypes was defined as an instance property on ClassicProperties.',
614 'contextTypes was defined as an instance property on ClassicProperties.',
615 'contextType was defined as an instance property on ClassicProperties.',
616 ]);