You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just like we have structure_type on the structures, I would like spirit_type on the spirits.
The idea here is to add Flow.js support for the global spirits value. Right now, I cannot create a proper union type because there's way to do disjoint unions:
// This says the keys are type SpiritId and the values are either type TriangleSpirit or type EnemySpirit
declare var spirits: { [SpiritId] : TriangleSpirit | EnemySpirit }
let spirit = spirits[0]
if (spirit.type === 'friend') { // <========== I want to be able to do this
// flow.js knows this is MyChosenSpirit, so it won't error when using its method:
spirit.explode()
}
Keeping with the naming used in spirit.sight, I'd imagine that the type would be: 'friend' | 'enemy'
Flow.js isn't smart enough to filter based on a function like (spirit.id.substring(0, MY_USERNAME.length) === MY_USERNAME).
Possible workaround
As a workaround, I'm going to try adding the type every tick to all spirits (and not running that code through Flow.js)
The text was updated successfully, but these errors were encountered:
Just like we have
structure_type
on the structures, I would likespirit_type
on the spirits.The idea here is to add Flow.js support for the global
spirits
value. Right now, I cannot create a proper union type because there's way to do disjoint unions:Keeping with the naming used in
spirit.sight
, I'd imagine that the type would be:'friend' | 'enemy'
Flow.js isn't smart enough to filter based on a function like (spirit.id.substring(0, MY_USERNAME.length) === MY_USERNAME).
Possible workaround
As a workaround, I'm going to try adding the type every tick to all spirits (and not running that code through Flow.js)
The text was updated successfully, but these errors were encountered: