Skip to content

Commit

Permalink
chore: typed config reducer (#424)
Browse files Browse the repository at this point in the history
* chore: typed config reducer

* restrict error type

Co-authored-by: atarashansky <[email protected]>
  • Loading branch information
atarashansky and atarashansky authored Aug 29, 2022
1 parent 51086b4 commit d11f8c6
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions client/src/reducers/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
const Config = (
state = {
import { AnyAction } from "redux";
import type { Config } from "../globals";

interface ConfigState {
features: Config["features"] | null;
parameters: Config["parameters"] | null;
displayNames: Config["displayNames"] | null;
loading?: boolean;
error?: Error | null;
corpora_props?: Config["corpora_props"];
library_versions?: Config["library_versions"];
portalUrl?: Config["portalUrl"];
links?: Config["links"];
}
const ConfigReducer = (
state: ConfigState = {
displayNames: null,
features: null,
parameters: null,
},
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
action: any
action: AnyAction
) => {
switch (action.type) {
case "initial data load start":
Expand All @@ -32,4 +44,4 @@ const Config = (
}
};

export default Config;
export default ConfigReducer;

0 comments on commit d11f8c6

Please sign in to comment.