Skip to content

fix(#53): stop exporting Color twice — it is a type, not a palette#102

Merged
proggeramlug merged 1 commit into
mainfrom
fix/gh53-color-type-value-collision
Jul 15, 2026
Merged

fix(#53): stop exporting Color twice — it is a type, not a palette#102
proggeramlug merged 1 commit into
mainfrom
fix/gh53-color-type-value-collision

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Closes #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
received 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 doesn't — 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, not assumed

  • Nothing in engine / shooter / editor / garden / 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 remains available
    everywhere it was.
  • shooter compiles and runs. jump's TypeScript compiles — it reaches the
    linker, which is what proves Color resolves 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

  • Bug Fixes
    • Corrected the public API so Color is available only as a type, avoiding conflicts with runtime exports.
    • Preserved access to ColorConstants and Colors as runtime values.

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
@proggeramlug proggeramlug merged commit 12ae8b9 into main Jul 15, 2026
@proggeramlug proggeramlug deleted the fix/gh53-color-type-value-collision branch July 15, 2026 16:33
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e116b50-ed71-457b-a9aa-db320e2dda1a

📥 Commits

Reviewing files that changed from the base of the PR and between c8a721e and db9bc97.

📒 Files selected for processing (2)
  • src/core/index.ts
  • src/index.ts

📝 Walkthrough

Walkthrough

The export surfaces stop re-exporting Color as a runtime value while preserving its TypeScript type export. Runtime exports for ColorConstants and Colors remain available.

Changes

Color export correction

Layer / File(s) Summary
Separate Color type and runtime exports
src/core/index.ts, src/index.ts
Removes the runtime Color re-export and preserves the Color type export alongside ColorConstants and Colors.

Estimated code review effort: 1 (Trivial) | ~5 minutes

✨ 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/gh53-color-type-value-collision

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.

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.

Duplicate identifier Color in core/index.ts

1 participant