Skip to content

Commit 52b4b0e

Browse files
committed
expose SchemaCallback<T> type.
1 parent af654b4 commit 52b4b0e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@colyseus/schema",
3-
"version": "3.0.13",
3+
"version": "3.0.14",
44
"description": "Binary state serializer with delta encoding for games",
55
"bin": {
66
"schema-codegen": "./bin/schema-codegen",

src/decoder/strategy/StateCallbacks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import type { CollectionSchema } from "../../types/custom/CollectionSchema";
2020
export type GetCallbackProxy = (<T extends Schema>(instance: T) => CallbackProxy<T>);
2121

2222
export type CallbackProxy<T> = unknown extends T // is "any"?
23-
? InstanceCallback<T> & CollectionCallback<any, any>
23+
? SchemaCallback<T> & CollectionCallback<any, any>
2424
: T extends Collection<infer K, infer V, infer _>
2525
? CollectionCallback<K, V>
26-
: InstanceCallback<T>;
26+
: SchemaCallback<T>;
2727

28-
type InstanceCallback<T> = {
28+
export type SchemaCallback<T> = {
2929
/**
3030
* Trigger callback when value of a property changes.
3131
*
@@ -61,7 +61,7 @@ type InstanceCallback<T> = {
6161
[K in NonFunctionNonPrimitivePropNames<T>]: CallbackProxy<T[K]>;
6262
}
6363

64-
type CollectionCallback<K, V> = {
64+
export type CollectionCallback<K, V> = {
6565
/**
6666
* Trigger callback when an item has been added to the collection.
6767
*

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export { TypeContext } from "./types/TypeContext";
4545
// Annotation types
4646
export type { DefinitionType, PrimitiveType, Definition, } from "./annotations";
4747

48-
export { getDecoderStateCallbacks, CallbackProxy, GetCallbackProxy } from "./decoder/strategy/StateCallbacks";
48+
export { getDecoderStateCallbacks, CallbackProxy, SchemaCallback, CollectionCallback } from "./decoder/strategy/StateCallbacks";
4949
export { getRawChangesCallback } from "./decoder/strategy/RawChanges";
5050

5151
export { Encoder } from "./encoder/Encoder";

0 commit comments

Comments
 (0)