Room.lookForAtArea can return results in multiple formats. Not all are currently tested and not all are correctly typed.
Expected Behavior
Following code is working and should pass type checking.
Actual Behavior
s is typed as an object with two fields, type and structure. This is not what the game returns. As a result, following misleading error is returned for s.structureType:
Property 'structureType' does not exist on type 'LookForAtAreaResult<Structure, "structure">'. Did you mean 'structure'?ts(2551)
Sample code (if available)
const room = Game.rooms.W33S45, x = 21, y = 23;
room.lookForAtArea(LOOK_STRUCTURES, y, x, y, x)[y][x].find(s => s.structureType === STRUCTURE_CONTROLLER)
Room.lookForAtArea can return results in multiple formats. Not all are currently tested and not all are correctly typed.
Expected Behavior
Following code is working and should pass type checking.
Actual Behavior
s is typed as an object with two fields,
type
andstructure
. This is not what the game returns. As a result, following misleading error is returned for s.structureType:Property 'structureType' does not exist on type 'LookForAtAreaResult<Structure, "structure">'. Did you mean 'structure'?ts(2551)
Sample code (if available)
Your Environment