With the current type of world:set, the snippet below is valid. The current types use the same generic T for both the component and the data, which lets you pass an optional value into a required field.
const comp = world.component<{ required: boolean }>();
let required: boolean | undefined;
world.set(world.entity(), comp, { required }); // required field is made optional!
With the current type of world:set, the snippet below is valid. The current types use the same generic T for both the component and the data, which lets you pass an optional value into a required field.