Skip to content

fix: add missing closing quote in replaceReducer error message#4891

Merged
EskiMojo14 merged 2 commits into
reduxjs:masterfrom
JSap0914:fix/replace-reducer-error-message-missing-quote
Jun 29, 2026
Merged

fix: add missing closing quote in replaceReducer error message#4891
EskiMojo14 merged 2 commits into
reduxjs:masterfrom
JSap0914:fix/replace-reducer-error-message-missing-quote

Conversation

@JSap0914

Copy link
Copy Markdown
Contributor

Summary

Closes #4890

Bug

The error thrown by replaceReducer when called with a non-function was missing a closing single-quote around the received type value in the error message.

Before:

Expected the nextReducer to be a function. Instead, received: 'null

After:

Expected the nextReducer to be a function. Instead, received: 'null'

Root Cause

In src/createStore.ts, the template literal ended with }\`` instead of }'``:

// Before (bug)
`Expected the nextReducer to be a function. Instead, received: '${kindOf(
  nextReducer
)}`

// After (fix)
`Expected the nextReducer to be a function. Instead, received: '${kindOf(
  nextReducer
)}'`

Every other analogous error message in createStore.ts correctly 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.

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
Copilot AI review requested due to automatic review settings June 28, 2026 11:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pkg-pr-new

pkg-pr-new Bot commented Jun 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/redux@68f83ce -D
yarn add https://pkg.pr.new/redux@68f83ce.tgz -D
pnpm add https://pkg.pr.new/redux@68f83ce.tgz -D
bun add https://pkg.pr.new/redux@68f83ce.tgz -D

commit: 68f83ce

@aryaemami59 aryaemami59 changed the title fix: add missing closing quote in replaceReducer error message fix: add missing closing quote in replaceReducer error message Jun 28, 2026
@aryaemami59 aryaemami59 added this to the 6.0 milestone Jun 28, 2026
@EskiMojo14 EskiMojo14 merged commit e402da9 into reduxjs:master Jun 29, 2026
24 checks passed
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.

bug: replaceReducer error message is missing a closing quote around the received type

4 participants