-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor(router-core): parseSegment buffer type can be asserted w/o returning it #5908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(router-core): parseSegment buffer type can be asserted w/o returning it #5908
Conversation
WalkthroughparseSegment's signature was changed from returning a Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant parseSegment
participant OutputBuffer
rect rgb(230,240,250)
Note over Caller,parseSegment: Old flow (return-based)
Caller->>parseSegment: parseSegment(path, start, output)
parseSegment->>OutputBuffer: mutate output buffer
parseSegment-->>Caller: return modified buffer
Caller->>Caller: assign returned buffer to local variable
end
rect rgb(240,250,240)
Note over Caller,parseSegment: New flow (assert-based)
Caller->>parseSegment: parseSegment(path, start, output)
parseSegment->>OutputBuffer: mutate output buffer + assert type
parseSegment-->>Caller: no value returned (type asserted)
Caller->>OutputBuffer: access output directly (type narrowed)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (5)📓 Common learnings📚 Learning: 2025-09-22T00:56:53.426ZApplied to files:
📚 Learning: 2025-09-22T00:56:49.237ZApplied to files:
📚 Learning: 2025-10-01T18:30:26.591ZApplied to files:
📚 Learning: 2025-10-08T08:11:47.088ZApplied to files:
🧬 Code graph analysis (1)packages/router-core/src/path.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=test:eslint,test:unit,tes... |
❌ Failed | 1h 59m 31s | View ↗ |
nx run-many --target=build --exclude=examples/*... |
✅ Succeeded | 1m 27s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-11-19 22:49:05 UTC
…e-without-returning
We can use typescript
assertsto for the type of theUint16Arraybuffer ofparseSegmentinstead of returning it. It's not much, but it makes using this function a little cleaner, and maybe more clear that it modifies the input buffer (instead of returning a new buffer).Summary by CodeRabbit
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.