refactor: replace || with ?? for nullish coalescing#707
refactor: replace || with ?? for nullish coalescing#707kamilwronka wants to merge 1 commit intodevelopfrom
Conversation
…ant ?? undefined - migrate-loots.ts: remove redundant `?? undefined` in getItemTypeByCl - migrate-loots.ts: use ?? instead of || for hpp (preserves 0 as valid value) - event-kill.service.ts: use ?? instead of || for numeric/nullable fields across map data builders (presenceTimeSeconds, afkTimeSeconds, etc.) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors two files to consistently use nullish-coalescing ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Summary
?? undefinedingetItemTypeByCl(return type already allowsundefined)player.hpp || nulltoplayer.hpp ?? nullto preserve0as a valid HP value|| 0,|| "",|| nullto?? 0,?? "",?? nullfor numeric/nullable fields in map data builders (3 locations)Why this is safe
All changes only affect behavior when values are falsy-but-valid (
0,"",false). ForMap.get()calls the behavior is identical since missing keys returnundefined. For numeric fields likepresenceTimeSeconds,afkTimeSeconds, andhpp,??correctly preserves0instead of falling through to the default.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes