@colyseus/schema 4.0.16 → 4.0.17
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 +2 -2
- package/build/annotations.d.ts +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Schema.ts +2 -2
package/package.json
CHANGED
package/src/Schema.ts
CHANGED
|
@@ -122,7 +122,7 @@ export class Schema<C = any> implements IRef {
|
|
|
122
122
|
* @param jsonData JSON data to restore the instance from
|
|
123
123
|
* @returns
|
|
124
124
|
*/
|
|
125
|
-
public restore(jsonData: ToJSON<
|
|
125
|
+
public restore<T extends Partial<this>>(jsonData: ToJSON<T>): this {
|
|
126
126
|
const metadata: Metadata = (this.constructor as typeof Schema)[Symbol.metadata];
|
|
127
127
|
|
|
128
128
|
for (const fieldIndex in metadata) {
|
|
@@ -224,7 +224,7 @@ export class Schema<C = any> implements IRef {
|
|
|
224
224
|
return cloned;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
toJSON (this: any): ToJSON<this
|
|
227
|
+
toJSON (this: any): ToJSON<Partial<this>> {
|
|
228
228
|
const obj: any = {};
|
|
229
229
|
const metadata = this.constructor[Symbol.metadata];
|
|
230
230
|
for (const index in metadata) {
|