Repository navigation
Drop the freezes from the entities and derive their lists uniformly - #142
Merged
Merged
Conversation
Object.freeze carried a runtime cost for a guarantee the definitions never needed, and it is dropped in favour of the const type assertion alone. The derived lists now come from Object.values of their map, the shape game-status.js already used, so the map is the single source and the reduce-based constructions are gone. The 139 exports of the package compare equal before and after, and the codegen output regenerates unchanged.
Only route.js and tag.js reach source/index.js; the other six were reachable solely through the ./helpers/* subpath and belong to the consumers that use them rather than to the domain definitions. Consumers pin exact versions, so the removal lands with their next bump — url still imports getOwn from helpers/object across its route modules and its codegen, and has to carry those functions itself before it takes this release.
A route without parameters had to be given an empty array anyway, so the array now defaults to one and the type check in front of it is gone. The default covers an explicitly passed undefined as well, which is what url() forwards when its own caller omits the argument.
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.
Object.freeze carried a runtime cost for a guarantee the definitions never needed, and it is dropped in favour of the const type assertion alone. The derived lists now come from Object.values of their map, the shape game-status.js already used, so the map is the single source and the reduce-based constructions are gone.
Verified: the 139 exports of the package compare equal before and after, none added or removed; the codegen output regenerates byte-identical from the new segment.js and routes.js; typecheck reports no error inside source/entities.