fix: add missing closing quote in replaceReducer error message#4891
Merged
EskiMojo14 merged 2 commits intoJun 29, 2026
Merged
Conversation
The error message thrown by replaceReducer when a non-function is passed was missing a closing single-quote around the received type value. Before: "Expected the nextReducer to be a function. Instead, received: 'null" After: "Expected the nextReducer to be a function. Instead, received: 'null'" Every other kindOf-based error message in createStore.ts correctly wraps the received value in single quotes (e.g. reducer, enhancer, listener, observer). This was a typo — the template literal ended with `}` instead of `}'`. Closes reduxjs#4890
commit: |
replaceReducer error message
aryaemami59
approved these changes
Jun 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4890
Bug
The error thrown by
replaceReducerwhen called with a non-function was missing a closing single-quote around the received type value in the error message.Before:
After:
Root Cause
In
src/createStore.ts, the template literal ended with}\`` instead of}'``:Every other analogous error message in
createStore.tscorrectly wraps the received type in single quotes:Expected the root reducer to be a function. Instead, received: '${kindOf(reducer)}'Expected the enhancer to be a function. Instead, received: '${kindOf(enhancer)}'Expected the listener to be a function. Instead, received: '${kindOf(listener)}'Expected the observer to be an object. Instead, received: '${kindOf(observer)}'Verification
The existing test only checked a partial string prefix (
'Expected the nextReducer to be a function.'), which passed even with the broken message. The updated test now asserts the full message including the received type wrapped in quotes, catching this class of regression.