-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added 'remove-runtime-proptypes' option
- Loading branch information
Keyan Zhang
committed
Jul 5, 2016
1 parent
62978f4
commit ee36b61
Showing
4 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* @flow */ | ||
|
||
var React = require('react'); | ||
|
||
const justNeedKeys = { | ||
a: 12, | ||
b: 23, | ||
}; | ||
|
||
var Component = React.createClass({ | ||
propTypes: { | ||
optionalMessage: React.PropTypes.instanceOf(Message), | ||
optionalMessageOops: React.PropTypes.instanceOf(foo()), | ||
optionalEnum: React.PropTypes.oneOf(Object.keys(justNeedKeys)), | ||
optionalEnumOops: React.PropTypes.oneOf(bar), | ||
optionalUnion: React.PropTypes.oneOfType([ | ||
React.PropTypes.string, | ||
React.PropTypes.number, | ||
React.PropTypes.instanceOf(Message), | ||
]), | ||
optionalUnionOops: React.PropTypes.oneOfType(foo()), | ||
optionalUnionOops2: React.PropTypes.oneOfType(Bar), | ||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number), | ||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number), | ||
optionalObjectWithShape: React.PropTypes.shape({ | ||
color: React.PropTypes.string, | ||
fontSize: foo, | ||
name: bla(), | ||
}), | ||
optionalObjectWithShapeOops: React.PropTypes.shape(foo()), | ||
optionalObjectWithShapeOops2: React.PropTypes.shape(bla), | ||
'is-literal-cool': React.PropTypes.bool, | ||
'well-fine': React.PropTypes.number.isRequired, | ||
}, | ||
|
||
render: function() { | ||
return ( | ||
<div>type safety</div> | ||
); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* @flow */ | ||
|
||
var React = require('react'); | ||
|
||
const justNeedKeys = { | ||
a: 12, | ||
b: 23, | ||
}; | ||
|
||
class Component extends React.Component { | ||
props: { | ||
optionalMessage?: Message, | ||
optionalMessageOops?: $FlowFixMe, | ||
optionalEnum?: $FlowFixMe, | ||
optionalEnumOops?: $FlowFixMe, | ||
optionalUnion?: string | number | Message, | ||
optionalUnionOops?: $FlowFixMe, | ||
optionalUnionOops2?: $FlowFixMe, | ||
optionalArrayOf?: Array<number>, | ||
optionalObjectOf?: {[key: string]: number}, | ||
optionalObjectWithShape?: { | ||
color?: string, | ||
fontSize?: $FlowFixMe, | ||
name?: $FlowFixMe, | ||
}, | ||
optionalObjectWithShapeOops?: $FlowFixMe, | ||
optionalObjectWithShapeOops2?: $FlowFixMe, | ||
'is-literal-cool'?: boolean, | ||
'well-fine': number, | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div>type safety</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters