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

Commit e6060a6

Browse files
committed
no any
add types
1 parent 05cb407 commit e6060a6

File tree

16 files changed

+118
-32
lines changed

16 files changed

+118
-32
lines changed

app/components/LoadingIndicator/Circle.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const circleFadeDelay = keyframes`
1313
}
1414
`;
1515

16-
const Circle = props => {
16+
interface Props {
17+
rotate?: number;
18+
delay?: number;
19+
id?: string;
20+
}
21+
const Circle = (props: Props) => {
1722
const CirclePrimitive = styled.div`
1823
width: 100%;
1924
height: 100%;

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,19 @@ describe('<ReposList />', () => {
2424
});
2525

2626
it('should render the repositories if loading was successful', () => {
27+
28+
const initialState = {
29+
global: {
30+
currentUser: 'mxstbr',
31+
error: false,
32+
loading: false,
33+
userData: {
34+
repositories: false,
35+
},
36+
},
37+
};
2738
const store = configureStore(
28-
{ global: { currentUser: 'mxstbr' } },
39+
initialState,
2940
browserHistory,
3041
);
3142
const repos = [

app/configureStore.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
* Create the store with dynamic reducers
33
*/
44

5-
import { createStore, applyMiddleware, compose } from 'redux';
5+
import { applyMiddleware, compose, createStore } from 'redux';
66
import { routerMiddleware } from 'connected-react-router';
77
import createSagaMiddleware from 'redux-saga';
88
import createReducer from './reducers';
99
import { InjectedStore } from 'types';
10+
import { History } from 'history';
11+
import { RootState } from './containers/App/types';
1012

1113
declare interface IWindow extends Window {
1214
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any; // redux-dev-tools definitions not needed
1315
}
16+
1417
declare const window: IWindow;
1518

16-
export default function configureStore(initialState = {}, history) {
19+
export default function configureStore(initialState: RootState | {} = {}, history: History) {
1720
let composeEnhancers = compose;
1821
const reduxSagaMonitorOptions = {};
1922

app/containers/App/tests/selectors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('makeSelectError', () => {
5959
describe('makeSelectRepos', () => {
6060
it('should select the repos', () => {
6161
const reposSelector = makeSelectRepos();
62-
const repositories = [];
62+
const repositories: any[] = [];
6363
const mockedState: any = {
6464
global: {
6565
userData: {

app/containers/RepoListItem/tests/index.test.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ import RepoListItem from '../index';
1212
import configureStore from '../../../configureStore';
1313

1414
const renderComponent = (item, currentUser) => {
15-
const store = configureStore({ global: { currentUser } }, browserHistory);
15+
const initialState = {
16+
global: {
17+
currentUser,
18+
error: false,
19+
loading: false,
20+
userData: {
21+
repositories: false,
22+
},
23+
},
24+
};
25+
const store = configureStore(
26+
initialState, browserHistory);
1627

1728
return render(
1829
// tslint:disable-next-line: jsx-wrap-multiline

app/tests/store.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
import { browserHistory } from 'react-router-dom';
66
import configureStore from '../configureStore';
7+
import { InjectedStore } from '../types';
78

89
describe('configureStore', () => {
9-
let store;
10+
let store: InjectedStore;
1011

1112
beforeAll(() => {
1213
store = configureStore({}, browserHistory);

app/types/react-intl.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
declare module 'react-intl' {
2+
export const IntlProvider: any;
3+
export const FormattedMessage: any;
4+
export const defineMessages: any;
5+
export const FormattedNumber: any;
6+
export const injectIntl: any;
7+
8+
}

app/utils/tests/checkStore.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
*/
44

55
import checkStore from '../checkStore';
6+
import { InjectedStore } from '../../types';
7+
import { Action, Dispatch } from 'redux';
8+
9+
const action: Action<number> = {
10+
type: 10,
11+
};
12+
const disp: Dispatch<typeof action> = (param) => param;
13+
614

715
describe('checkStore', () => {
8-
let store;
16+
let store: Omit<InjectedStore, 'Symbol[Observable'>;
917

1018
beforeEach(() => {
1119
store = {
12-
dispatch: () => {},
13-
subscribe: () => {},
20+
dispatch: disp,
21+
subscribe: (listener) => () => {},
1422
getState: () => {},
1523
replaceReducer: () => {},
1624
runSaga: () => {},

app/utils/tests/injectSaga.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { getInjectors } from '../sagaInjectors';
1414

1515

1616
import { createMemoryHistory } from 'history';
17+
import { InjectedStore } from '../../types';
1718

1819
const memoryHistory = createMemoryHistory();
1920

@@ -26,8 +27,8 @@ function* testSaga() {
2627

2728
jest.mock('../sagaInjectors');
2829
describe('injectSaga decorator', () => {
29-
let store;
30-
let injectors;
30+
let store: InjectedStore;
31+
let injectors: /*typeof getInjectors*/ any;
3132
let ComponentWithSaga;
3233

3334
beforeAll(() => {

internals/templates/configureStore.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
* Create the store with dynamic reducers
33
*/
44

5-
import { createStore, applyMiddleware, compose } from 'redux';
5+
import { applyMiddleware, compose, createStore } from 'redux';
66
import { routerMiddleware } from 'connected-react-router';
77
import createSagaMiddleware from 'redux-saga';
88
import createReducer from './reducers';
99
import { InjectedStore } from 'types';
10+
import { History } from 'history';
11+
import { RootState } from '../../app/containers/App/types';
12+
1013

1114
declare interface IWindow extends Window {
1215
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any; // redux-dev-tools definitions not needed
1316
}
1417
declare const window: IWindow;
1518

16-
export default function configureStore(initialState = {}, history) {
19+
export default function configureStore(initialState: RootState | {} = {}, history: History) {
1720
let composeEnhancers = compose;
1821
const reduxSagaMonitorOptions = {};
1922

0 commit comments

Comments
 (0)