schema icon indicating copy to clipboard operation
schema copied to clipboard

[Bug]: `delete` keyword should not break schemas completely

Open endel opened this issue 2 months ago • 0 comments

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)

endel avatar Oct 21 '25 20:10 endel