-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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 from ElementProperties #21350
Changes from 3 commits
fb8ecde
3d5acca
5282b6f
92fe916
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
'use strict'; | ||
|
||
const BoxInspector = require('BoxInspector'); | ||
const PropTypes = require('prop-types'); | ||
const React = require('React'); | ||
const StyleInspector = require('StyleInspector'); | ||
const StyleSheet = require('StyleSheet'); | ||
|
@@ -24,29 +23,21 @@ const flattenStyle = require('flattenStyle'); | |
const mapWithSeparator = require('mapWithSeparator'); | ||
const openFileInEditor = require('openFileInEditor'); | ||
|
||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet'; | ||
import type {ViewStyleProp} from 'StyleSheet'; | ||
|
||
class ElementProperties extends React.Component<{ | ||
type Props = $ReadOnly<{| | ||
hierarchy: Array<$FlowFixMe>, | ||
style?: DangerouslyImpreciseStyleProp, | ||
source?: { | ||
fileName?: string, | ||
lineNumber?: number, | ||
style?: ?ViewStyleProp, | ||
source?: ?{ | ||
fileName?: ?string, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure these should be nullable. Lets leave fileName and lineNumber the way they were:
|
||
lineNumber?: ?number, | ||
}, | ||
}> { | ||
static propTypes = { | ||
hierarchy: PropTypes.array.isRequired, | ||
style: PropTypes.oneOfType([ | ||
PropTypes.object, | ||
PropTypes.array, | ||
PropTypes.number, | ||
]), | ||
source: PropTypes.shape({ | ||
fileName: PropTypes.string, | ||
lineNumber: PropTypes.number, | ||
}), | ||
}; | ||
frame?: ?Object, | ||
selection?: ?number, | ||
setSelection?: (?number) => mixed, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setSelection is only ever called with a number, never with null, so the argument shouldn't be nullable. |
||
|}>; | ||
|
||
class ElementProperties extends React.Component<Props> { | ||
render() { | ||
const style = flattenStyle(this.props.style); | ||
// $FlowFixMe found when converting React.createClass to ES6 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier/prettier: Replace
(number)
withnumber