Skip to content

Can't access role from CreeperMemory #146

Open
@JQE

Description

@JQE

I setup the starter kit, and it works, then i start to add code.

I am now using the simplest thing i can think of

for (var name in Game.creeps) { if (Game.creeps[name].memory.role == "Harvester") { console.log("Harvester"); } }

When running this through the tester (or in game) i get the following error
`src/main.ts:15:34 - error TS2339: Property 'role' does not exist on type 'CreepMemory'.

15 if (Game.creeps[name].memory.role == "Harvester") {`

If i remove the interface definition from @types/screeps then it works. It seems that for some reason i can't merge the types using the types.d.ts.

I am new to typescript definitions, anyone got any advice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions