[PR #240] [MERGED] Loosen types to allow reducers with different update types #601

Closed
opened 2026-02-15 19:15:10 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/240
Author: @jacoblee93
Created: 7/3/2024
Status: Merged
Merged: 7/3/2024
Merged by: @jacoblee93

Base: mainHead: jacob/reducers


📝 Commits (1)

  • 3921d33 Loosen types to allow reducers with different update types

📊 Changes

4 files changed (+53 additions, -26 deletions)

View changed files

📝 docs/docs/concepts/index.md (+1 -1)
📝 langgraph/src/channels/binop.ts (+18 -16)
📝 langgraph/src/graph/state.ts (+11 -9)
📝 langgraph/src/tests/graph.test.ts (+23 -0)

📄 Description

Types are tricky and could use a refactor in general, but this unblocks an immediate issue

Supports

def update_dialog_stack(left: list[str], right: Optional[str]) -> list[str]:
    """Push or pop the state."""
    if right is None:
        return left
    if right == "pop":
        return left[:-1]
    return left + [right]

CC @nfcampos @hinthornw @andrewnguonly


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/240 **Author:** [@jacoblee93](https://github.com/jacoblee93) **Created:** 7/3/2024 **Status:** ✅ Merged **Merged:** 7/3/2024 **Merged by:** [@jacoblee93](https://github.com/jacoblee93) **Base:** `main` ← **Head:** `jacob/reducers` --- ### 📝 Commits (1) - [`3921d33`](https://github.com/langchain-ai/langgraphjs/commit/3921d33d8977ae7d1b32215501a6c32860038356) Loosen types to allow reducers with different update types ### 📊 Changes **4 files changed** (+53 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `docs/docs/concepts/index.md` (+1 -1) 📝 `langgraph/src/channels/binop.ts` (+18 -16) 📝 `langgraph/src/graph/state.ts` (+11 -9) 📝 `langgraph/src/tests/graph.test.ts` (+23 -0) </details> ### 📄 Description Types are tricky and could use a refactor in general, but this unblocks an immediate issue Supports ``` def update_dialog_stack(left: list[str], right: Optional[str]) -> list[str]: """Push or pop the state.""" if right is None: return left if right == "pop": return left[:-1] return left + [right] ``` CC @nfcampos @hinthornw @andrewnguonly --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 19:15:10 -05:00
yindo closed this issue 2026-02-15 19:15:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#601