Skip to content

[Bug]: delete keyword should not break schemas completely #209

@endel

Description

@endel

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions