diff --git a/package.json b/package.json index 31a4bfa1..b6bc3ae8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@colyseus/schema", - "version": "2.0.16", + "version": "2.0.17", "description": "Binary state serializer with delta encoding for games", "bin": { "schema-codegen": "./bin/schema-codegen" @@ -78,7 +78,7 @@ "source-map-support": "^0.5.13", "ts-node": "^7.0.1", "tslib": "^2.1.0", - "tsx": "^3.12.7", + "tsx": "^3.13.0", "typescript": "^5.0.4" }, "nyc": { diff --git a/src/Schema.ts b/src/Schema.ts index 6505d3bd..20e72a44 100644 --- a/src/Schema.ts +++ b/src/Schema.ts @@ -898,7 +898,7 @@ export abstract class Schema { const schema = this._definition.schema; const deprecated = this._definition.deprecated; - const obj: ToJSON = {}; + const obj: unknown = {}; for (let field in schema) { if (!deprecated[field] && this[field] !== null && typeof (this[field]) !== "undefined") { obj[field] = (typeof (this[field]['toJSON']) === "function") @@ -906,7 +906,7 @@ export abstract class Schema { : this[`_${field}`]; } } - return obj; + return obj as ToJSON; } discardAllChanges() { diff --git a/src/types/HelperTypes.ts b/src/types/HelperTypes.ts index a221850d..0d94a46c 100644 --- a/src/types/HelperTypes.ts +++ b/src/types/HelperTypes.ts @@ -9,10 +9,10 @@ export type NonFunctionPropNames = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T]; -export type ToJSON = Partial = NonFunctionProps<{ [K in keyof T]: T[K] extends MapSchema ? Record : T[K] extends ArraySchema ? U[] : T[K] -}>>; \ No newline at end of file +}>; \ No newline at end of file