fix(#53): stop exporting Color twice — it is a type, not a palette#102
Merged
Conversation
Reported in #53. `core/index.ts` exported the name `Color` twice: once as the RGBA TYPE (from ./types) and once as a palette MAP (from ./colors). Every consumer got both, and the map shadowed the thing people actually annotate with. The reporter asked whether dropping `Color` from ./colors and standardising on `Colors` would have side effects. It does not, and the palette loses nothing — it already had two other names: `Colors`, and `ColorConstants`, which is literally `= Color`. Three names for one map, one of them colliding with a type. Verified before removing, rather than assumed: - No code in engine, shooter, editor, garden or jump reads the palette through the name `Color` (i.e. `Color.Red`). The only `Color.*` hits are inside colors.ts itself, referring to its own local const. - `jump` DOES import `Color` from bloom/core — but only ever in TYPE position (`const WHITE: Color = { r, g, b, a }`), which the type re-export still serves. - The root index already re-exported the type separately (`export type { Vec2, Vec3, Vec4, Color }`), so `Color` stays available everywhere it was. - shooter compiles + runs; jump's TypeScript compiles (it now fails later, at link, on pre-existing engine drift — a different problem, see the jump commit). Claude-Session: https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe export surfaces stop re-exporting ChangesColor export correction
Estimated code review effort: 1 (Trivial) | ~5 minutes ✨ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53.
core/index.tsexported the nameColortwice: once as the RGBA type(from
./types) and once as a palette map (from./colors). Every consumerreceived both, and the map shadowed the thing people actually annotate with.
The reporter asked whether dropping
Colorfrom./colorsand standardising onColorswould have side effects. It doesn't — and the palette loses nothing.It already had two other names:
Colors, andColorConstants, which isliterally
= Color. Three names for one map, one of them colliding with a type.Verified before removing, not assumed
through the name
Color(i.e.Color.Red). The onlyColor.*hits are insidecolors.tsitself, referring to its own local const.jumpdoes importColorfrombloom/core— but only ever in typeposition (
const WHITE: Color = { r, g, b, a }), which the type re-exportstill serves.
(
export type { Vec2, Vec3, Vec4, Color }), soColorremains availableeverywhere it was.
linker, which is what proves
Colorresolves for a consumer that imports it.(jump then fails at link on pre-existing engine drift — a separate problem,
see the jump PR.)
https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp
Summary by CodeRabbit
Coloris available only as a type, avoiding conflicts with runtime exports.ColorConstantsandColorsas runtime values.