Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove propTypes on instance warning #30296

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/react-reconciler/src/ReactFiberClassComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' +
Expand Down
7 changes: 0 additions & 7 deletions packages/react-server/src/ReactFizzClassComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ describe 'ReactCoffeeScriptClass', ->
constructor: ->
@contextTypes = {}
@contextType = {}
@propTypes = {}

getInitialState: ->
getInitialStateWasCalled = true
Expand All @@ -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.',
])
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/__tests__/ReactES6Class-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ describe('ReactES6Class', () => {
super();
this.contextTypes = {};
this.contextType = {};
this.propTypes = {};
}
getInitialState() {
getInitialStateWasCalled = true;
Expand All @@ -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.',
]);
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/__tests__/ReactTypeScriptClass-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ let getDefaultPropsWasCalled = false;
class ClassicProperties extends React.Component {
contextTypes = {};
contextType = {};
propTypes = {};
getDefaultProps() {
getDefaultPropsWasCalled = true;
return {};
Expand Down Expand Up @@ -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.',
]);
Expand Down