Tweak Snapshot type so it treats regular arrays and maps the same as ArraySchema and MapSchema - #9
Open
FTWinston wants to merge 3 commits into
Open
Tweak Snapshot type so it treats regular arrays and maps the same as ArraySchema and MapSchema#9FTWinston wants to merge 3 commits into
FTWinston wants to merge 3 commits into
Conversation
FTWinston
marked this pull request as ready for review
June 1, 2026 23:09
endel
added a commit
that referenced
this pull request
Aug 11, 2026
The IArray/IMap types and structural Snapshot branches were already absorbed into this branch (49bb64a) in extended form — concrete ArraySchema/MapSchema branches kept first for element inference, v5 internals stripped — so conflicts resolve to the branch's version. New from the PR: prepublishOnly → prepare, so git revisions (npm i colyseus/react-tools#0.18) build dist on install. Assisted-by: Claude Fable 5
2 tasks
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.
I stupidly thought I was working on a fork, and pushed this to main. I've reverted it now. Sorry!
This PR allows the
Snapshottype to treatMaptypes the same way it treatsMapSchematypes. It makes it easier to write prop types for react components without having to reference colyseus schema types directly.In a shared package, I have:
In my engine package, I have:
And in my frontend package, I have:
This pattern already works for
ArraySchemaand classes extendingSchema, but the transformation ofMapSchema<T>toRecord<string, T>means this change is needed to work withMapSchema.