Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StructureSpawn should be a class #54

Closed
seancl opened this issue Jul 24, 2016 · 1 comment
Closed

StructureSpawn should be a class #54

seancl opened this issue Jul 24, 2016 · 1 comment

Comments

@seancl
Copy link
Contributor

seancl commented Jul 24, 2016

Currently TypeScript rejects this if condition:

s instanceof StructureSpawn

since StructureSpawn is defined as a type, not a class. However, this works:

s instanceof Spawn

This is somewhat annoying, since the two do seem to be interchangeable. The docs, for what it's worth, specifically refer to the class/prototype as "StructureSpawn" (not "Spawn"): http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn

@NhanHo
Copy link
Collaborator

NhanHo commented Jul 25, 2016

StructureSpawnwas something added later in the game, it was originally Spawn (that's why both are supported in the game). I kept it as Spawn for backward compatibility, but didn't realize alias type won't allow instanceof.

I've changed StructureSpawn to extends Spawn with no other change. It should fix the instanceof problem but let me know if it causes anything else

@NhanHo NhanHo closed this as completed Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants