@colyseus/schema 4.0.17 → 4.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/Schema.d.ts CHANGED
@@ -53,7 +53,7 @@ export declare class Schema<C = any> implements IRef {
53
53
  * @param jsonData JSON data to restore the instance from
54
54
  * @returns
55
55
  */
56
- restore<T extends Partial<this>>(jsonData: ToJSON<T>): this;
56
+ restore(jsonData: ToJSON<this>): this;
57
57
  /**
58
58
  * (Server-side): Flag a property to be encoded for the next patch.
59
59
  * @param instance Schema instance
@@ -62,7 +62,7 @@ export declare class Schema<C = any> implements IRef {
62
62
  */
63
63
  setDirty<K extends NonFunctionPropNames<this>>(property: K | number, operation?: OPERATION): void;
64
64
  clone(): this;
65
- toJSON(this: any): ToJSON<Partial<this>>;
65
+ toJSON(this: any): ToJSON<this>;
66
66
  /**
67
67
  * Used in tests only
68
68
  * @internal
@@ -63,7 +63,7 @@ export declare function view<T>(tag?: number): (target: T, fieldName: string) =>
63
63
  export declare function unreliable<T>(target: T, field: string): void;
64
64
  export declare function type(type: DefinitionType, options?: TypeOptions): PropertyDecorator;
65
65
  export declare function getPropertyDescriptor(fieldCached: string, fieldIndex: number, type: DefinitionType, complexTypeKlass: TypeDefinition): {
66
- get: (this: Schema) => number | ((index: number) => any) | ((index: number) => void) | (() => Schema<any>) | (<T extends Partial<Schema<any>>>(props: AssignableProps<T>) => Schema<any>) | (<T extends Partial<Schema<any>>>(jsonData: import("./index.js").ToJSON<T>) => Schema<any>) | (<K extends "~refId">(property: number | K, operation?: OPERATION) => void) | ((this: any) => import("./index.js").ToJSON<Partial<Schema<any>>>) | (() => void);
66
+ get: (this: Schema) => number | ((index: number) => any) | ((index: number) => void) | (() => Schema<any>) | (<T extends Partial<Schema<any>>>(props: AssignableProps<T>) => Schema<any>) | ((jsonData: import("./index.js").ToJSON<Schema<any>>) => Schema<any>) | (<K extends "~refId">(property: number | K, operation?: OPERATION) => void) | ((this: any) => import("./index.js").ToJSON<Schema<any>>) | (() => void);
67
67
  set: (this: Schema, value: any) => void;
68
68
  enumerable: boolean;
69
69
  configurable: boolean;
@@ -36,7 +36,7 @@ export declare class StateCallbackStrategy<TState extends IRef> {
36
36
  /**
37
37
  * Listen to property changes on a nested instance.
38
38
  */
39
- listen<TInstance extends Schema, K extends PublicPropNames<TInstance>>(instance: TInstance, property: K, handler: PropertyChangeCallback<TInstance[K]>, immediate?: boolean): () => void;
39
+ listen<TInstance, K extends PublicPropNames<TInstance>>(instance: TInstance, property: K, handler: PropertyChangeCallback<TInstance[K]>, immediate?: boolean): () => void;
40
40
  protected listenInstance<TInstance extends IRef>(instance: TInstance, propertyName: string, handler: PropertyChangeCallback<any>, immediate?: boolean): () => void;
41
41
  /**
42
42
  * Listen to any property change on an instance.