screepers / Screeps-Typescript-Declarations

The repository for *Screeps's* TypeScript type definitions.
69 stars 44 forks source link

Interfaces instead of declared classes #123

Open dbaileychess opened 7 years ago

dbaileychess commented 7 years ago

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)

thaelina commented 7 years ago

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.

dbaileychess commented 7 years ago

The npm package (4.2.1) is outdated or pointing to the 'classes' branch then, most definitions are still 'classes' in the npm package.

thaelina commented 7 years ago

Ah, well the repo is almost all interfaces. Personally I use typings

Dessix commented 7 years ago

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.