ten1seven / what-input

A global utility for tracking the current input method (mouse/pointer, keyboard or touch).
https://ten1seven.github.io/what-input
MIT License
1.35k stars 89 forks source link

Add TypeScript type definition #106

Closed greypants closed 4 years ago

greypants commented 4 years ago

Hey @ten1seven - we're converting to typescript, and have typed what-input locally. I'll open a PR soon to add this to your package so it ships fully typed!

This is what we have locally - i need to double check the API and make sure it's correct and complete. PR forthcoming...

declare module "what-input" {
  export interface WhatInput {
    ask(intent?: string): string | null;
    ignoreKeys(keys: (string | number)[]): void;
    registerOnChange(callback: () => void, intent: string): void;
    unRegisterOnChange(callback: () => void): void;
  }

  const whatInput: WhatInput;

  export default whatInput;
}
ten1seven commented 4 years ago

Oh, cool! I'm excited!

greypants commented 4 years ago

Resolved by #107