redux#CombinedState TypeScript Examples

The following examples show how to use redux#CombinedState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: store.ts    From UsTaxes with GNU Affero General Public License v3.0 7 votes vote down vote up
persistedReducer = fsReducer(
  'ustaxes_save.json',
  persistReducer<CombinedState<YearsTaxesState>, Actions>(
    {
      key: 'root',
      // Changing the version here will set the version used
      // in the app. When the data is rehydrated the version
      // number will be compared and all migrations between
      // the persisted version and the version here will be
      // applied in order
      version: 1,
      storage,
      migrate: createMigrate(migrations, { debug: false }),
      transforms: [dateStringTransform]
    },
    rootReducer
  )
)
Example #2
Source File: RawDataConverter.ts    From alchemist with MIT License 6 votes vote down vote up
public static replaceArrayBuffer(obj: ActionDescriptor[]|ActionDescriptor): ActionDescriptor[]|ActionDescriptor {
		const store:Store<CombinedState<{inspector: IInspectorState;}>, AnyAction> = (window as any)._rootStore;
		const settings = getInspectorSettings(store.getState());
		if (!settings.makeRawDataEasyToInspect) {
			return obj;
		}
		rec(obj);
		return obj;

		function rec(data:any) {
			for (const key in data) {
				if (Object.prototype.hasOwnProperty.call(data, key)) {
					if (Array.isArray(data)) {
						for (const item of data) {
							rec(item);
						}
					}
					else if (data[key] instanceof ArrayBuffer) {
						const uint = new Uint8Array(data[key]);
						const arr: number[] = Array.from(uint);

						if (settings.makeRawDataEasyToInspect) {
							data[key] = {
								"_rawData": "alchemistFakeType",
								"_data": arr,
							};							
						} else {
							data[key] = "<ArrayBuffer> This value was ignored for performance reasons. Turn this on in Alchemist > Settings > Support raw data type";
						}
					}
					else if (typeof data[key] === "object") {
						rec(data[key]);
					}
				}				
			}
		}
	}
Example #3
Source File: reducer.ts    From UsTaxes with GNU Affero General Public License v3.0 6 votes vote down vote up
rootReducer: Reducer<
  CombinedState<YearsTaxesState>,
  Actions
> = combineReducers({
  assets: assetReducer,
  Y2019: guardByYear('Y2019'),
  Y2020: guardByYear('Y2020'),
  Y2021: guardByYear('Y2021'),
  activeYear
}) as Reducer<CombinedState<YearsTaxesState>, Actions>