olioapps / aframe-typescript-toolkit

Convenience utilities and base classes that can be used to build aframe components using typescript.
MIT License
23 stars 5 forks source link

[BUG] add() function does not exist in system in SphereRegistryComponent.System #15

Open ResourceHog opened 5 years ago

ResourceHog commented 5 years ago

create a default system with aframe-typescript-toolkit

npm run start

open console

index.ts:21 Uncaught (in promise) TypeError: this.system.add is not a function at i.SphereRegistryComponent.init (VM1783 index.js:10035) at i.updateProperties (component.js:270) at HTMLElement.value (a-entity.js:501) at HTMLElement.value (a-entity.js:474) at a-entity.js:267 at a-node.js:129

upon inspection this.system is undefined so of course this.system.add is not a function. This behavior is strange doesn't aframe automatically add systems to components of the same name?

ResourceHog commented 5 years ago

before running the add function setting this.system to the SphereRegistrySystem will fix this issue however we lose some type safety. We are essentially crossing our fingers and hoping that the types are correct here.

this.system = document.querySelector('a-scene').systems['sphere-registry'] as SphereRegistrySystem;

joserick commented 3 years ago

@ResourceHog Thanks for the code line, I hope @rachoac or @stormihoebe fix this sometime.