Remove propTypes on instance warning (#30296)

`propTypes` are no longer supported at all in React 19, remove this
outdated warning.
This commit is contained in:
Jan Kassens
2024-07-09 13:29:50 -04:00
committed by GitHub
parent c3cdbec0a7
commit ba95cf4b8f
5 changed files with 0 additions and 20 deletions

View File

@@ -376,13 +376,6 @@ function checkClassInstance(workInProgress: Fiber, ctor: any, newProps: any) {
name,
);
}
if (instance.propTypes) {
console.error(
'propTypes was defined as an instance property on %s. Use a static ' +
'property to define propTypes instead.',
name,
);
}
if (instance.contextType) {
console.error(
'contextType was defined as an instance property on %s. Use a static ' +

View File

@@ -353,13 +353,6 @@ function checkClassInstance(instance: any, ctor: any, newProps: any) {
name,
);
}
if (instance.propTypes) {
console.error(
'propTypes was defined as an instance property on %s. Use a static ' +
'property to define propTypes instead.',
name,
);
}
if (instance.contextType) {
console.error(
'contextType was defined as an instance property on %s. Use a static ' +

View File

@@ -411,7 +411,6 @@ describe 'ReactCoffeeScriptClass', ->
constructor: ->
@contextTypes = {}
@contextType = {}
@propTypes = {}
getInitialState: ->
getInitialStateWasCalled = true
@@ -431,7 +430,6 @@ describe 'ReactCoffeeScriptClass', ->
).toErrorDev([
'getInitialState was defined on Foo, a plain JavaScript class.',
'getDefaultProps was defined on Foo, a plain JavaScript class.',
'propTypes was defined as an instance property on Foo.',
'contextTypes was defined as an instance property on Foo.',
'contextType was defined as an instance property on Foo.',
])

View File

@@ -459,7 +459,6 @@ describe('ReactES6Class', () => {
super();
this.contextTypes = {};
this.contextType = {};
this.propTypes = {};
}
getInitialState() {
getInitialStateWasCalled = true;
@@ -477,7 +476,6 @@ describe('ReactES6Class', () => {
expect(() => runTest(<Foo />, 'SPAN', 'foo')).toErrorDev([
'getInitialState was defined on Foo, a plain JavaScript class.',
'getDefaultProps was defined on Foo, a plain JavaScript class.',
'propTypes was defined as an instance property on Foo.',
'contextType was defined as an instance property on Foo.',
'contextTypes was defined as an instance property on Foo.',
]);

View File

@@ -244,7 +244,6 @@ let getDefaultPropsWasCalled = false;
class ClassicProperties extends React.Component {
contextTypes = {};
contextType = {};
propTypes = {};
getDefaultProps() {
getDefaultPropsWasCalled = true;
return {};
@@ -612,7 +611,6 @@ describe('ReactTypeScriptClass', function() {
'a plain JavaScript class.',
'getDefaultProps was defined on ClassicProperties, ' +
'a plain JavaScript class.',
'propTypes was defined as an instance property on ClassicProperties.',
'contextTypes was defined as an instance property on ClassicProperties.',
'contextType was defined as an instance property on ClassicProperties.',
]);