Export vehicle Models VIN map as a public symbol - #14
Conversation
Mechanical reshuffle: move Models into the vehicle types leaf module, re-export from index.ts, no behavior change.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfef1a5e93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| hide_private: boolean; | ||
| }; | ||
|
|
||
| export const Models: Record<string, string> = { |
There was a problem hiding this comment.
Keep the exported model map immutable
Because this exported object is also the exact instance read by Vehicle.model(), a consumer can assign to or delete entries such as Models.S, silently changing model detection for every Vehicle instance in the process. This makes the previously private lookup table externally mutable despite the commit's intended behavior-preserving refactor; expose a runtime-frozen, read-only map or keep a separate internal copy.
Useful? React with 👍 / 👎.
Intent
Models) was a privateconstinsidesrc/vehicle.ts, so nothing outside this package could import it.Modelsintosrc/types/vehicle.ts(a narrow leaf module) and exported it there.src/vehicle.tsnow importsModelsfrom that leaf module;Vehicle.model()behavior is unchanged.Modelsfromsrc/index.tsas a supported public symbol.test/vehicle.test.tswith a seconddescribeblock asserting the publicModelsexport (imported viasrc/index.ts) maps every known VIN code, including Cybercab (A).Pure export/import reshuffle, no behavior change. Skipped the no-mistakes pipeline: mechanical export refactor, low risk.