Skip to content

Commit

Permalink
fix(typing): fixed typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Sep 6, 2022
1 parent 4d4e4d4 commit 56a61bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export const addStoreModule = <M>(path: string, module: M, store?: Store<RootSto
if (!store) {
store = getStore();
}
store.registerModule(path, module);
store.registerModule(path, module as any);
};
13 changes: 7 additions & 6 deletions src/utils/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ export const getDefaultStoreGetters = <T = any>(opts?: GetDefaultStoreGettersOpt
isBatchForm: (state: BaseStoreState<T>) => {
return state.isSelectiveForm || state.createEditDialogTabName === 'batch';
},
formListIds: (state: BaseStoreState<BaseModel>) => state.formList.map(d => d._id as string),
allListSelectOptions: (state: BaseStoreState<BaseModel>) => state.allList.map(d => {
formListIds: (state: BaseStoreState<T>) => state.formList.map(d => (d as BaseModel)._id as string),
allListSelectOptions: (state: BaseStoreState<T>) => state.allList.map(d => {
const _d = d as BaseModel;
return {
value: d[opts?.selectOptionValueKey as string],
label: d[opts?.selectOptionLabelKey as string],
value: _d[opts?.selectOptionValueKey as string],
label: _d[opts?.selectOptionLabelKey as string],
};
}),
allDict: (state: BaseStoreState<BaseModel>) => {
allDict: (state: BaseStoreState<T>) => {
const dict = new Map<string, T>();
state.allList.forEach(d => dict.set(d._id as string, d as any));
state.allList.forEach(d => dict.set((d as BaseModel)._id as string, d as any));
return dict;
},
/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/tree.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const getNormalizedNodes = <T = any>(node: TreeNode<T>): T[] => {
let nodes = [] as T[];
nodes.push(node as T);
node.children?.forEach(subNode => {
node.children?.forEach((subNode: any) => {
nodes = nodes.concat(getNormalizedNodes(subNode));
});
return nodes;
Expand Down

0 comments on commit 56a61bb

Please sign in to comment.