Finished with types
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// @flow()
|
||||
|
||||
import { configure } from "@storybook/react";
|
||||
|
||||
configure(() => {
|
||||
|
||||
Generated
+741
-4330
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,9 @@
|
||||
"eslint-plugin-babel": "^5.1.0",
|
||||
"eslint-plugin-flowtype": "^2.49.3",
|
||||
"eslint-plugin-react": "^7.10.0",
|
||||
"flow": "^0.2.3",
|
||||
"flow-bin": "^0.75.0",
|
||||
"flow-coverage-report": "^0.5.0",
|
||||
"flow-typed": "^2.4.0",
|
||||
"react-app-rewire-eslint": "^0.2.3",
|
||||
"react-app-rewired": "^1.5.2"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import React from "react";
|
||||
import { RegionsInformationTable } from "./components/regionsInformationTable";
|
||||
|
||||
class App extends React.PureComponent {
|
||||
class App extends React.PureComponent<{}> {
|
||||
render() {
|
||||
return <RegionsInformationTable />;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* flow() */
|
||||
|
||||
import React from "react";
|
||||
import { storiesOf } from "@storybook/react";
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@ import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import "../general.css";
|
||||
|
||||
export class CountryFilterBar extends React.PureComponent {
|
||||
export class CountryFilterBar extends React.PureComponent<{
|
||||
list: Array<{ code: string, name: string }>,
|
||||
onSelect: string => void
|
||||
}> {
|
||||
static propTypes = {
|
||||
list: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onSelect: PropTypes.func.isRequired
|
||||
|
||||
@@ -5,7 +5,11 @@ import PropTypes from "prop-types";
|
||||
|
||||
import "../general.css";
|
||||
|
||||
export class ExpandableCard extends React.PureComponent {
|
||||
export class ExpandableCard extends React.PureComponent<{
|
||||
name: string,
|
||||
cities: number,
|
||||
population: number
|
||||
}> {
|
||||
static propTypes = {
|
||||
name: PropTypes.string.isRequired,
|
||||
cities: PropTypes.number.isRequired,
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
/* @flow */
|
||||
|
||||
import React from "react";
|
||||
import * as React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import "../general.css";
|
||||
import "./expandableCard.css";
|
||||
|
||||
export class ExpandableCard extends React.PureComponent {
|
||||
export class ExpandableCard extends React.PureComponent<
|
||||
{
|
||||
children: React.ChildrenArray<React.ChildrenArray<React.Node>>,
|
||||
title: string
|
||||
},
|
||||
{ open: boolean }
|
||||
> {
|
||||
static propTypes = {
|
||||
children: PropTypes.arrayOf(PropTypes.element).isRequired,
|
||||
title: PropTypes.string.isRequired
|
||||
|
||||
@@ -5,7 +5,21 @@ import React from "react";
|
||||
import { CountryFilterBar } from "../countryFilterBar";
|
||||
import { ResultsDataTable } from "../resultsDataTable.2";
|
||||
|
||||
export class RegionsInformationTable extends React.PureComponent {
|
||||
export class RegionsInformationTable extends React.PureComponent<
|
||||
{},
|
||||
{
|
||||
countries: Array<{
|
||||
code: string,
|
||||
name: string
|
||||
}>,
|
||||
regions: Array<{
|
||||
id: string,
|
||||
name: string,
|
||||
cities: number,
|
||||
pop: number
|
||||
}>
|
||||
}
|
||||
> {
|
||||
state = {
|
||||
countries: [
|
||||
{ code: "AR", name: "Argentine" },
|
||||
|
||||
@@ -6,9 +6,20 @@ import PropTypes from "prop-types";
|
||||
import { ExpandableCard } from "../expandableCard.1";
|
||||
import "../general.css";
|
||||
|
||||
export class ResultsDataTable extends React.PureComponent {
|
||||
export class ResultsDataTable extends React.PureComponent<{
|
||||
results: Array<{
|
||||
id: string,
|
||||
name: string,
|
||||
cities: number,
|
||||
pop: number
|
||||
}>
|
||||
}> {
|
||||
static propTypes = {
|
||||
results: PropTypes.arrayOf(PropTypes.object).isRequired
|
||||
results: PropTypes.arrayOf(PropTypes.object)
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
results: []
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -6,7 +6,14 @@ import PropTypes from "prop-types";
|
||||
import { ExpandableCard } from "../expandableCard.2";
|
||||
import "../general.css";
|
||||
|
||||
export class ResultsDataTable extends React.PureComponent {
|
||||
export class ResultsDataTable extends React.PureComponent<{
|
||||
results: Array<{
|
||||
id: string,
|
||||
name: string,
|
||||
cities: number,
|
||||
pop: number
|
||||
}>
|
||||
}> {
|
||||
static propTypes = {
|
||||
results: PropTypes.arrayOf(PropTypes.object).isRequired
|
||||
};
|
||||
|
||||
@@ -4,7 +4,12 @@ import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
|
||||
//$FlowFixMe
|
||||
import registerServiceWorker from "./registerServiceWorker";
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById("root"));
|
||||
const root = document.getElementById("root");
|
||||
if (root) {
|
||||
ReactDOM.render(<App />, root);
|
||||
}
|
||||
registerServiceWorker();
|
||||
|
||||
Reference in New Issue
Block a user