Skip to content

Fix: [Section] Scalable Application Structure - #343

Closed
Ghostofcaldera wants to merge 1 commit into
piotrwitek:masterfrom
Ghostofcaldera:fix/issue-42-1781381198
Closed

Fix: [Section] Scalable Application Structure#343
Ghostofcaldera wants to merge 1 commit into
piotrwitek:masterfrom
Ghostofcaldera:fix/issue-42-1781381198

Conversation

@Ghostofcaldera

Copy link
Copy Markdown

Fixes #42

This PR addresses the IssueHunt-funded issue #42.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new documentation file outlining a feature-based, scalable structure for React + Redux + TypeScript applications. The feedback points out that the dynamic store configuration example uses Record<string, any> as the accumulator type in reduce, which causes a loss of type safety for RootState. It suggests typing the accumulator as Partial<typeof AVAILABLE_FEATURES> to preserve type safety.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +95 to +100
const enabledReducers = Object.keys(AVAILABLE_FEATURES).reduce((acc, key) => {
if (ENABLED_FEATURES.includes(key)) {
acc[key] = AVAILABLE_FEATURES[key as keyof typeof AVAILABLE_FEATURES];
}
return acc;
}, {} as Record<string, any>);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using Record<string, any> as the accumulator type in reduce causes the resulting enabledReducers object to lose all TypeScript type safety. Consequently, RootState (defined as ReturnType<typeof store.getState>) will resolve to Record<string, any> instead of a strongly-typed state object.

To preserve type safety, type the accumulator as Partial<typeof AVAILABLE_FEATURES>.

Suggested change
const enabledReducers = Object.keys(AVAILABLE_FEATURES).reduce((acc, key) => {
if (ENABLED_FEATURES.includes(key)) {
acc[key] = AVAILABLE_FEATURES[key as keyof typeof AVAILABLE_FEATURES];
}
return acc;
}, {} as Record<string, any>);
const enabledReducers = Object.keys(AVAILABLE_FEATURES).reduce((acc, key) => {
if (ENABLED_FEATURES.includes(key)) {
const featureKey = key as keyof typeof AVAILABLE_FEATURES;
acc[featureKey] = AVAILABLE_FEATURES[featureKey];
}
return acc;
}, {} as Partial<typeof AVAILABLE_FEATURES>);

@Ghostofcaldera

Copy link
Copy Markdown
Author

Closing as duplicate. The latest fix is in PR #341 (for issue #55) or PR #338 (for issue #42). The duplicate check has been improved to prevent this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Section] Scalable Application Structure

1 participant