GaryStanton / phaser3-merged-input

A Phaser 3 plugin to map input from keyboard & gamepad to player actions
MIT License
34 stars 5 forks source link

chore: added typescript typings #16

Closed zewa666 closed 2 years ago

zewa666 commented 2 years ago

this adds basic typescript typings so that TS based users may consume your great plugin more easily.

I did not include the generation part as I wasn't sure whether you want to bloat your project with addtional config files and dependencies so instead just created this one-time snapshot

zewa666 commented 2 years ago

hey @GaryStanton, anything I can do to improve this PR for you?

GaryStanton commented 2 years ago

Hi, thanks for this. Sorry I haven’t merged it in yet - I don’t really know anything about TypeScript so was planning to do some reading to figure out what you’ve done before merging, but I’ve not had a chance and I don’t want to leave you hanging, so I’ll just merge it in now. I really appreciate you taking the time to do this, just wanted to understand what it was doing before adding it to the codebase!!

zewa666 commented 2 years ago

@GaryStanton so in essence what the package.json entry does is tell typescript on the consumer side "if you import a dependency look in this file mentioned in typings for type definitions if the source aint ts but vanilla js"

the typings themselve are mainly auto generated using the tsc build tool and turning on typedefinition output. additionally I`ve sprinkled a couple of additional more detailed types the auto-gen wasnt able to do.