JairusSW / as-json

The only JSON library you'll need for AssemblyScript. SIMD enabled
MIT License
80 stars 16 forks source link

bug: @omit'ed fields are not removed from transform-side schema #76

Closed JairusSW closed 5 months ago

JairusSW commented 5 months ago

If you take something like this:

import { JSON } from ".";

@json
class Base {}
@json
class Vec1 extends Base {
  x: f64 = 1.0;
}
@json
class Vec2 extends Vec1 {
  @omit()
  y: f32 = 2.0;
}
@json
class Vec3 extends Vec2 {
  z: f32 = 3.0;
}

const arr: Base[] = [
  new Vec1(),
  new Vec2(),
  new Vec3()
];

console.log(JSON.stringify(arr));

It return this.

[{"x":1.0},{"x":1.0,"x":1.0,null},{null,"x":1.0,null,"x":1.0,"z":3.0}]