Screeps-Typescript-Declarations icon indicating copy to clipboard operation
Screeps-Typescript-Declarations copied to clipboard

Update RoomVisual.poly to also accept positions

Open Dessix opened this issue 8 years ago • 3 comments

From the documentation:

points | array | An array of points.
Every item should be either an array with 2 numbers (i.e. [10,15]), or a RoomPosition object.

Dessix avatar Jul 22 '17 22:07 Dessix

The changes I've pushed allow objects meeting the { x: number, y: number } structural interface to be used in place of RoomPosition instances. I've tested these as working. This also changes RoomVisual's constructor to the Typescript standard es6 declaration style, wherein the constructor and instance types are separate interfaces, and provides separate subtypes for differentiating the availability of roomName depending on whether or not the "global" constructor was used.

Dessix avatar Jul 23 '17 08:07 Dessix

I tested these changes and was unable to declare a RoomVisual Error:(39, 19) TS2693:'RoomVisual' only refers to a type, but is being used as a value here. let vis = new RoomVisual();

Need to add declare const RoomVisual: RoomVisualConstructor;

I know this has been languishing here, but hopefully we can get this repo updated and such

thaelina avatar Oct 03 '17 15:10 thaelina

Added constructor object instance for RoomVisual as per @thaelina's suggestion and rebuilt.

Dessix avatar Oct 04 '17 05:10 Dessix