From 411b97de1408c3910464d71d4ece982350f68585 Mon Sep 17 00:00:00 2001 From: Can Sahin Date: Sun, 23 Dec 2018 14:31:09 +0300 Subject: [PATCH] =?UTF-8?q?=E2=80=98npm=20run=20clean=E2=80=99=20bugs=20fi?= =?UTF-8?q?xed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internals/scripts/clean.js | 12 +++++++----- internals/templates/reducers.ts | 2 -- internals/templates/types/index.d.ts | 28 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 internals/templates/types/index.d.ts diff --git a/internals/scripts/clean.js b/internals/scripts/clean.js index 52a93e04..f7f7df07 100644 --- a/internals/scripts/clean.js +++ b/internals/scripts/clean.js @@ -39,12 +39,14 @@ shell.rm('-rf', 'app/utils'); shell.mv('internals/templates/utils', 'app'); // Replace the files in the root app/ folder -shell.cp('internals/templates/app.js', 'app/app.js'); -shell.cp('internals/templates/global-styles.js', 'app/global-styles.js'); -shell.cp('internals/templates/i18n.js', 'app/i18n.js'); +shell.cp('internals/templates/app.tsx', 'app/app.tsx'); +shell.cp('internals/templates/global-styles.ts', 'app/global-styles.ts'); +shell.cp('internals/templates/i18n.ts', 'app/i18n.ts'); shell.cp('internals/templates/index.html', 'app/index.html'); -shell.cp('internals/templates/reducers.js', 'app/reducers.js'); -shell.cp('internals/templates/configureStore.js', 'app/configureStore.js'); +shell.cp('internals/templates/reducers.ts', 'app/reducers.ts'); +shell.cp('internals/templates/configureStore.ts', 'app/configureStore.ts'); + +shell.cp('internals/templates/types/index.d.ts', 'app/types/index.d.ts'); // Remove the templates folder shell.rm('-rf', 'internals/templates'); diff --git a/internals/templates/reducers.ts b/internals/templates/reducers.ts index c74313fe..31976a8d 100644 --- a/internals/templates/reducers.ts +++ b/internals/templates/reducers.ts @@ -6,7 +6,6 @@ import { combineReducers } from 'redux'; import { connectRouter } from 'connected-react-router'; import history from 'utils/history'; -import globalReducer from 'containers/App/reducer'; import languageProviderReducer from 'containers/LanguageProvider/reducer'; /** @@ -14,7 +13,6 @@ import languageProviderReducer from 'containers/LanguageProvider/reducer'; */ export default function createReducer(injectedReducers = {}) { const rootReducer = combineReducers({ - global: globalReducer, language: languageProviderReducer, ...injectedReducers, }); diff --git a/internals/templates/types/index.d.ts b/internals/templates/types/index.d.ts new file mode 100644 index 00000000..da3e298a --- /dev/null +++ b/internals/templates/types/index.d.ts @@ -0,0 +1,28 @@ +import { Reducer, Store } from 'redux'; +import { RouterState } from 'connected-react-router'; +import { ILanguageProviderProps } from 'containers/LanguageProvider'; + +export interface LifeStore extends Store<{}> { + injectedReducers?: any; + injectedSagas?: any; + runSaga(saga: () => IterableIterator, args: any): any; +} + +export interface InjectReducerParams { + key: keyof ApplicationRootState; + reducer: Reducer; +} + +export interface InjectSagaParams { + key: keyof ApplicationRootState; + saga: () => IterableIterator; + mode?: string | undefined; +} + +// Your root reducer type, which is your redux state types also +export interface ApplicationRootState { + readonly router: RouterState; + readonly language: ILanguageProviderProps; + // for testing purposes + readonly test: any; +}