Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 23348c6

Browse files
committed
remove lookup types, too verbose
reverted redundant destructuring aliases optimize imports
1 parent 4977d41 commit 23348c6

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

app/components/List/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import * as React from 'react';
33
import Ul from './Ul';
44
import Wrapper from './Wrapper';
55
import { Repo } from '../../containers/RepoListItem/types';
6-
import { UserData } from '../../containers/App/types';
76

87
interface Props {
98
component: React.ComponentType<any>;
10-
items?: UserData['repos'];
9+
items?: Repo[];
1110
}
1211

1312
function List(props: Props) {
@@ -31,5 +30,4 @@ function List(props: Props) {
3130
);
3231
}
3332

34-
const items: UserData['repos'] = [];
3533
export default List;

app/components/ReposList/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ import LoadingIndicator from 'components/LoadingIndicator';
66
import RepoListItem from 'containers/RepoListItem';
77
import { ContainerState, UserData } from '../../containers/App/types';
88

9-
interface Props {
10-
loading?: ContainerState['loading'];
11-
error?: ContainerState['error'];
12-
repos?: UserData['repos'];
13-
}
9+
export type ReposListProps = Pick<ContainerState, 'loading' | 'error'> & Pick<UserData, 'repos'>;
1410

15-
function ReposList({ loading, error, repos }: Props) {
11+
function ReposList({ loading, error, repos }: ReposListProps) {
1612
if (loading) {
1713
return <List component={LoadingIndicator} />;
1814
}

app/components/ReposList/tests/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('<ReposList />', () => {
5555
// tslint:disable-next-line: jsx-wrap-multiline
5656
<Provider store={store}>
5757
<IntlProvider locale="en">
58-
<ReposList repos={repos} error={false} />
58+
<ReposList repos={repos} error={false} loading={false}/>
5959
</IntlProvider>
6060
</Provider>,
6161
);

app/containers/App/types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ActionType } from 'typesafe-actions';
22
import * as actions from './actions';
3-
import { ApplicationRootState } from 'types';
43
import { Repo } from '../RepoListItem/types';
4+
import { ApplicationRootState } from '../../types';
55

66
/* --- STATE --- */
77

@@ -13,7 +13,7 @@ interface AppState {
1313
}
1414

1515
interface UserData {
16-
readonly repos?: Repo[]; // too many fields. Won't declare them all
16+
readonly repos?: Repo[];
1717
}
1818

1919

app/containers/HomePage/index.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@
44
* This is the first thing users see of our App, at the '/' route
55
*/
66

7-
import React, { useEffect, memo } from 'react';
7+
import React, { useEffect } from 'react';
88
import { Helmet } from 'react-helmet';
99
import { FormattedMessage } from 'react-intl';
10-
import { connect, useSelector, useDispatch } from 'react-redux';
11-
import { compose, Dispatch } from 'redux';
10+
import { useDispatch, useSelector } from 'react-redux';
1211
import { createStructuredSelector } from 'reselect';
1312

1413
import { useInjectReducer } from 'utils/injectReducer';
1514
import { useInjectSaga } from 'utils/injectSaga';
16-
import {
17-
makeSelectRepos,
18-
makeSelectLoading,
19-
makeSelectError,
20-
} from 'containers/App/selectors';
15+
import { makeSelectError, makeSelectLoading, makeSelectRepos } from 'containers/App/selectors';
2116
import H2 from 'components/H2';
2217
import ReposList from 'components/ReposList';
2318
import AtPrefix from './AtPrefix';

0 commit comments

Comments
 (0)