Convert `propTypes` to typescript version of props.
See original GitHub issueconvert old way of handling props like this example:
static propTypes = {
className: PropTypes.string,
selected: PropTypes.number,
leftButton: PropTypes.element,
scrollOver: PropTypes.bool
};
to new way of handling props like
interface WrapperProps {
orderBook: OutcomeOrderBook;
allowanceBigNumber: BigNumber;
market: MarketData;
initialLiquidity?: Boolean;
}
interface WrapperState {
orderPrice: string;
orderQuantity: string;
}
class Wrapper extends Component<WrapperProps, WrapperState> {
static defaultProps = {
selectedOutcome: null,
};
...
there are many examples in the codebase, all *.tsx should use interfaces for props and state. not all components have an internal state or props. Not all components have default props or default the state properties.
not all .tsx files are full React components they might be simple pure components.
look at augur/packages/augur-ui/src/modules/create-market/link.tsx
to see a simple component that uses props in the new format.
augur/packages/augur-ui/src/modules/account/components/activity.tsx
uses props and state and defaults state.
augur/packages/augur-ui/src/modules/markets-list/components/markets-view.tsx
uses props and state and defaults props
search the code base for import PropTypes from "prop-types";
There are 49 uses of it.
these files will not need that import after refactor.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
@gitstart-augur – Here is a good first ticket to work
Here is a partial PR with some of the fix as a starting point: https://github.com/AugurProject/augur/pull/3670
@bthaile Ping one more time, removing from UI Refactoring so I can try and close that out.