Screeps-Typescript-Declarations
Screeps-Typescript-Declarations copied to clipboard
Interfaces instead of declared classes
Wouldn't it make more sense to have the screeps.d.ts generated with 'Interfaces' instead of 'declare class'? This repo isn't providing any implementation, its more used as a type system.
See (https://stackoverflow.com/questions/14311675/typescript-declaration-files-contain-class-definitions-with-no-member-implementa/14323673#14323673 and https://stackoverflow.com/questions/14345485/whats-the-difference-between-declare-class-and-interface-in-typescript)
Taking a look at the repo, the only instance of a declare class is for RoomVisual which can be an interface as well, I think.
The npm package (4.2.1) is outdated or pointing to the 'classes' branch then, most definitions are still 'classes' in the npm package.
Ah, well the repo is almost all interfaces. Personally I use typings
Yes, interfaces allow extension, especially static extension using the duet declaration with a constructor interface, so this is the preference set by the Typescript standard library.