fix(types): allow undefined for trailing wildcard params - #198
Conversation
📝 WalkthroughWalkthroughTrailing wildcard parameters now allow ChangesTrailing wildcard parameter types
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/types.ts (1)
27-27: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression assertion for
MatchedRoute.params.The supplied
test/types.test-d.tsverifiesInferRouteParamsbut not this changed public type. Add an assertion such asMatchedRoute["params"]equalsRecord<string, string | undefined> | undefinedso the runtime{ "0": undefined }contract cannot regress.As per path instructions,
test/**/*.{ts,d.ts}must maintain regression coverage and verify public API types there.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/types.ts` at line 27, Add a type-level regression assertion in test/types.test-d.ts for MatchedRoute["params"], verifying it equals Record<string, string | undefined> | undefined. Keep the existing InferRouteParams assertions intact and ensure the test covers the public MatchedRoute params contract, including undefined values.Source: Path instructions
test/wpt.test.ts (1)
263-266: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAlign
normalizeGroupswith the widened match params contract.
MatchStrategy.matchallowsRecord<string, string | undefined>, somatch.groupsvalues may be missing/undefined. UpdatenormalizeGroupsto accept and return groups containingundefinedvalues instead of hiding that possibility withRecord<string, string>.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/wpt.test.ts` around lines 263 - 266, Update normalizeGroups to accept and return group records typed as Record<string, string | undefined>, matching the widened params contract of MatchStrategy.match. Preserve its existing normalization behavior while allowing missing or undefined group values instead of narrowing them to strings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/types.ts`:
- Line 27: Add a type-level regression assertion in test/types.test-d.ts for
MatchedRoute["params"], verifying it equals Record<string, string | undefined> |
undefined. Keep the existing InferRouteParams assertions intact and ensure the
test covers the public MatchedRoute params contract, including undefined values.
In `@test/wpt.test.ts`:
- Around line 263-266: Update normalizeGroups to accept and return group records
typed as Record<string, string | undefined>, matching the widened params
contract of MatchStrategy.match. Preserve its existing normalization behavior
while allowing missing or undefined group values instead of narrowing them to
strings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 262c5260-13d6-437c-8ab0-dfa52c867f38
📒 Files selected for processing (4)
src/types.tstest/find.test.tstest/types.test-d.tstest/wpt.test.ts
Summary by CodeRabbit
New Features
Tests