schema
schema copied to clipboard
[Bug]: `delete` keyword should not break schemas completely
Bug description
This test case is currently failing.
class Player extends Schema {
@type("string") id = nanoid();
}
class State extends Schema {
@type(Player) host = new Player();
}
const state = new State();
delete state.host; // this causes the error
state.encodeAll(); // TypeError: Cannot read properties of undefined (reading '~changes')
Stack trace:
TypeError: Cannot read properties of undefined (reading '~changes')
at encodeValue (src/encoder/EncodeOperation.ts:42:35)
at encodeSchemaOperation (src/encoder/EncodeOperation.ts:85:5)
at Encoder.encode (src/encoder/Encoder.ts:119:17)
at Encoder.encodeAll (src/encoder/Encoder.ts:155:21)