Skip to content

fix: exclude undefined from TypedRun/TypedClientRun output default type#145

Merged
coji merged 2 commits into
mainfrom
fix/typed-run-output-undefined
Mar 24, 2026
Merged

fix: exclude undefined from TypedRun/TypedClientRun output default type#145
coji merged 2 commits into
mainfrom
fix/typed-run-output-undefined

Conversation

@coji
Copy link
Copy Markdown
Owner

@coji coji commented Mar 24, 2026

Summary

  • TypedRun / TypedClientRun / UseRunsResult / UseRunsClientResultTOutput デフォルト値から undefined を除外
  • 型パラメータ省略時に outputRecord<string, unknown> | null になり、不要な undefined チェックが不要に
  • デフォルト型パラメータの型テストを追加

Closes #142

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • 型定義の最適化

    • 汎用型のデフォルトを簡素化し、型推論の挙動を安定化。公開APIの型表現は維持したまま、型チェックの精度と一貫性を向上しました。
  • テスト追加

    • 型推論の挙動を検証するコンパイル時テストを追加し、期待される出力型(null含む)であることを確認しました。

Change TOutput default from `Record<string, unknown> | undefined` to
`Record<string, unknown>` so that `output` is `TOutput | null` without
an unnecessary `undefined` union member.

Closes #142

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
durably-demo Ready Ready Preview Mar 24, 2026 1:47pm
durably-demo-vercel-turso Ready Ready Preview Mar 24, 2026 1:47pm

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
durably-demo-vercel-turso Building Building Preview Mar 24, 2026 1:42pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 844e7451-eca3-458b-a588-2a016efdccb6

📥 Commits

Reviewing files that changed from the base of the PR and between 57e6119 and d972001.

📒 Files selected for processing (3)
  • packages/durably-react/src/client/use-runs.ts
  • packages/durably-react/src/hooks/use-runs.ts
  • packages/durably-react/tests/types.test.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/durably-react/tests/types.test.ts
  • packages/durably-react/src/client/use-runs.ts

📝 Walkthrough

Walkthrough

TypedRunTypedClientRunTOutput デフォルトが複合型から Record<string, unknown> に修正され、undefined を除外しました。型推論が期待どおり output: Record<string, unknown> | null を返すことを確認するテストを追加しています。

Changes

Cohort / File(s) Summary
型定義の修正
packages/durably-react/src/types.ts
TypedRunTypedClientRunTOutput デフォルトを Record<string, unknown> に変更し、デフォルト時の output 型から undefined を除外。
フック型定義の調整
packages/durably-react/src/hooks/use-runs.ts, packages/durably-react/src/client/use-runs.ts
UseRunsResult / UseRunsClientResultTOutput デフォルトを同様に Record<string, unknown> に変更して型推論を整合。
型テストの追加
packages/durably-react/tests/types.test.ts
useRuns (browser)useRuns (client) に対するコンパイル時型推論アサーションを追加し、output が `Record<string, unknown>

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 型畑でひょこり跳ねて、
いらない undefined を引き抜いたよ。
残ったのは null と綺麗な形、
テストがにっこり「そのとおり!」。
ぽかぽかコード、今日も平和 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR タイトルは、TypedRun/TypedClientRun の出力デフォルト型から undefined を除外するという主要な変更を正確に要約しており、簡潔で明確です。
Linked Issues check ✅ Passed PR は #142 の要件を完全に満たしており、TOutput のデフォルト値から undefined を削除して output を Record<string, unknown> | null に修正し、型テストも追加されています。
Out of Scope Changes check ✅ Passed すべての変更は #142 で指定された範囲内であり、TypedRun/TypedClientRun、UseRunsResult/UseRunsClientResult の TOutput デフォルト型の修正と関連する型テストに限定されています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/typed-run-output-undefined

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Also remove redundant comments in type tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coji coji merged commit d8c03de into main Mar 24, 2026
5 checks passed
@coji coji deleted the fix/typed-run-output-undefined branch March 24, 2026 13:48
@coji coji mentioned this pull request Mar 29, 2026
4 tasks
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.

fix: TypedClientRun の output 型から undefined を除外

1 participant