LastOliveGames / becsy

A multithreaded Entity Component System (ECS) for TypeScript and JavaScript, inspired by ECSY and bitecs.
MIT License
196 stars 17 forks source link

Avoid TypeError on field.updateBuffer #9

Closed marionebl closed 2 years ago

marionebl commented 2 years ago

I'm running into an issue where using a BackRefType causes this line to fail; given the types indicate updateBuffer is optional not executing it if its undefined seems prudent.


This change is Reviewable

pkaminski commented 2 years ago

The type is an approximation, as are many of the types in that area of the code. The invariant is supposed to be that all fields in an elastic binding have an updateBuffer method. The correct fix is to add it for backref fields (as you did), but keep the ! on the access.

To save time on turnarounds, I went ahead and made the fix myself, and published 0.9.1. Thanks for tracking this down, though!

marionebl commented 2 years ago

Thanks for the quick release!