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

Commit a4f992f

Browse files
authored
no any (#31)
no any
2 parents b393f15 + db2b5dd commit a4f992f

File tree

14 files changed

+94
-30
lines changed

14 files changed

+94
-30
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/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/tests/store.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import history from '../utils/history';
55

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({}, history);

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

internals/templates/utils/request.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ResponseError extends Error {
1414
*
1515
* @return {object} The parsed JSON from the request
1616
*/
17-
function parseJSON(response) {
17+
function parseJSON(response: Response) {
1818
if (response.status === 204 || response.status === 205) {
1919
return null;
2020
}
@@ -28,12 +28,12 @@ function parseJSON(response) {
2828
*
2929
* @return {object|undefined} Returns either the response, or throws an error
3030
*/
31-
function checkStatus(response) {
31+
function checkStatus(response: Response) {
3232
if (response.status >= 200 && response.status < 300) {
3333
return response;
3434
}
3535

36-
const error = new ResponseError(response.statusText);
36+
const error = new ResponseError(response);
3737
error.response = response;
3838
throw error;
3939
}

internals/templates/utils/tests/injectSaga.test.tsx

Lines changed: 5 additions & 4 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 '../../../../app/types';
1718

1819
const memoryHistory = createMemoryHistory();
1920

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

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

3334
beforeAll(() => {
3435
const mockedGetInjectors = (getInjectors as unknown) as jest.Mock<
@@ -105,7 +106,7 @@ describe('injectSaga decorator', () => {
105106
});
106107

107108
describe('useInjectSaga hook', () => {
108-
let store;
109+
let store: InjectedStore;
109110
let injectors;
110111
let ComponentWithSaga;
111112

0 commit comments

Comments
 (0)