Entity: number & {
    __entity_type: "";
}

The Entity is a number type, the cast is only for typescript, the final javascript code treat as a number version number [31...16][15...0]

Convertion from entity to its compound numbers: To get the version => ((entity & MASK_UPPER_16_ON_32) >> 16) & MAX_U16 To get the number => entity & MAX_U16

Convertion from its compound numbers to entity: entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)