-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended defineTypes with filters #126
Draft
WesleyClements
wants to merge
2
commits into
colyseus:master
Choose a base branch
from
WesleyClements:extended-defineTypes-with-filters
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Extended defineTypes with filters #126
WesleyClements
wants to merge
2
commits into
colyseus:master
from
WesleyClements:extended-defineTypes-with-filters
Conversation
This file contains 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
WesleyClements
commented
Mar 31, 2022
@@ -122,7 +122,7 @@ export abstract class Schema { | |||
console.error(e); | |||
} | |||
|
|||
static is(type: DefinitionType) { | |||
static is(type: DefinitionType): type is typeof Schema { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related but useful for type inference
WesleyClements
commented
Mar 31, 2022
return klass._context && klass._context.useFilters; | ||
} | ||
|
||
function applyFilter(addFilter:(definition: SchemaDefinition, field: string) => boolean) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codeclimate flagged filter and filterChildren as potentially duplicate code so I refactored to appease it.
commit 156135e Author: Wesley Clements <[email protected]> Date: Thu Mar 31 18:02:06 2022 -0400 reverted change commit 5cb4f84 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 18:01:30 2022 -0400 removed auxiliary changes commit fc129ce Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:59:30 2022 -0400 updated to include match MapSchema commit 24cf717 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:58:19 2022 -0400 simplified exports commit ea383d0 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:56:35 2022 -0400 added new line at end of file commit e23ceae Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:56:11 2022 -0400 reverted change commit 93d99af Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:54:25 2022 -0400 updated exports to fix tests commit 58a7aa1 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:51:29 2022 -0400 reverted changes commit 6333d60 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:50:19 2022 -0400 removed unused type commit b11f201 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:49:59 2022 -0400 fixed typing conflicting with function commit c9d6e1a Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:48:57 2022 -0400 reverted changes commit fc84e37 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:48:27 2022 -0400 moved types around to better reflect domains commit 7c0fc9f Author: Wesley Clements <[email protected]> Date: Thu Mar 31 16:40:00 2022 -0400 refactored to reduce file bloat and impact on other files commit ac43f0f Author: Wesley Clements <[email protected]> Date: Thu Mar 31 15:21:49 2022 -0400 refactored to use optional chaining commit e0df843 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 14:51:53 2022 -0400 split annotations file into separate files by type commit e3e69c0 Author: Wesley Clements <[email protected]> Date: Thu Mar 31 14:21:35 2022 -0400 simplified types and implementation commit 8dfe1f0 Author: Wesley Clements <[email protected]> Date: Tue Mar 29 20:40:55 2022 -0400 changed to use Schema.is commit c7f0300 Author: Wesley Clements <[email protected]> Date: Tue Mar 29 20:39:38 2022 -0400 reverted "fix" commit 4747b73 Author: Wesley Clements <[email protected]> Date: Tue Mar 29 20:34:52 2022 -0400 fixed isPrototypeOf commit d723bbc Author: Wesley Clements <[email protected]> Date: Tue Mar 29 20:15:29 2022 -0400 simplified implementation commit cd7847b Author: Wesley Clements <[email protected]> Date: Fri Mar 18 03:00:30 2022 -0400 added defaults for generics commit 8c0c52a Author: Wesley Clements <[email protected]> Date: Fri Mar 18 02:53:15 2022 -0400 updated exports commit 9f06c01 Author: Wesley Clements <[email protected]> Date: Fri Mar 18 02:53:00 2022 -0400 refactored to address file length issue commit 706fb8e Author: Wesley Clements <[email protected]> Date: Fri Mar 18 02:00:31 2022 -0400 fixed strict equality for null
WesleyClements
force-pushed
the
extended-defineTypes-with-filters
branch
from
March 31, 2022 22:31
156135e
to
8dd3160
Compare
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.
Just a proposal for extending defineTypes to allow for the definition of filters.
This is really just to continue the work to make working with the annotation in JS more user friendly.
Fundamentally all I did was make it possible to pass in a config object in addition to a DefinitionType.
This would allow changing this code
into this
I had to split up annotations.ts in order to appease codeclimate's max file length.
I tired to handle it in a way that reduced impact to the rest of the codebase.