Ukendio / jecs

A fast, portable Entity Component System for Luau
https://ukendio.github.io/jecs/
MIT License
121 stars 20 forks source link

Fix world:set type #134

Open vnnh opened 6 hours ago

vnnh commented 6 hours ago

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!