danieltian / stream-deck-api

API to interact with the Elgato Stream Deck controller
69 stars 11 forks source link

feat: Add TypeScript typings #3

Closed TimLuq closed 6 years ago

TimLuq commented 6 years ago

Added type definitions in an index.d.ts file.

To not add a dependency to @types/node I simplified all Buffer references to instead use the superclass Uint8Array. This may may create a warning or error for users using, as a Buffer without a cast, the resolved value of the promise returned in drawImageFile() when used in typescript.

Additionally some methods technically inherited from EventEmitter has been left out. (Among these once(), addEventListener().) This is because of the discrepancy of the optional throttling argument and the non-standard void return value of on() which makes it somewhat incompatible.

danieltian commented 6 years ago

Hi TimLuq! Nice to see that there's some attention for this library 😃. At this time, however, the project will not be switching over to TypeScript. I will unfortunately have to close this PR. I do appreciate you putting it together though! 💯

TimLuq commented 6 years ago

This wasn't a switch to TS, though. The PR is only for accompanying types available to users of the library (using either VS Code or TS) not changes to the library code itself.