require<T extends Component> method
T
require<T extends Component>()
Reads the component of type T, throwing if absent.
Implementation
T require<T extends Component>() {
return switch (world._readComponent<T>(this)) {
Some(value: final v) => v,
None() => throw StateError(
'Entity $id has no component of type $T.',
),
};
}