mirror of
https://github.com/facebook/react.git
synced 2026-02-22 03:42:05 +00:00
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:
@@ -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 ' +
|
||||
|
||||
@@ -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 ' +
|
||||
|
||||
@@ -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.',
|
||||
])
|
||||
|
||||
@@ -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.',
|
||||
]);
|
||||
|
||||
@@ -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.',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user