Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide TypeScript types #464

Open
simonihmig opened this issue Sep 21, 2021 · 3 comments · May be fixed by #769
Open

Provide TypeScript types #464

simonihmig opened this issue Sep 21, 2021 · 3 comments · May be fixed by #769

Comments

@simonihmig
Copy link
Contributor

Would be great if the addon would ship with its own index.d.ts types! 😀

@lukemelia
Copy link
Collaborator

Yes, please! I would also be open to authoring this addon in typescript.

@NullVoxPopuli
Copy link
Collaborator

anyone have some local .d.ts file that we can paste in to the addon's directory? 😅

@charlesfries
Copy link

charlesfries commented Jan 24, 2024

@NullVoxPopuli this is what I use currently

// types/ember-keyboard/helpers/on-key.d.ts

import Helper from '@ember/component/helper';

export default class OnKeyHelper extends Helper<{
  Args: {
    Positional: [keyCombo: string, callback: (event: KeyboardEvent) => void];
  };
  Return: void;
}> {}
// types/ember-keyboard/modifiers/on-key.d.ts

import Modifier from 'ember-modifier';

export default class OnKeyModifier extends Modifier<{
  Args: {
    Positional: [keyCombo: string, callback?: (event: KeyboardEvent) => void];
    Named: {
      activated?: boolean;
      event?: string;
      priority?: number;
      onlyWhenFocused?: boolean;
    };
  };
  Element: HTMLElement;
}> {}
// types/ember-keyboard/test-support/test-helpers.d.ts

export function keyDown(keyCombo: string): Promise<void>;
export function keyUp(keyCombo: string): Promise<void>;
export function keyPress(keyCombo: string): Promise<void>;

@charlesfries charlesfries linked a pull request Jan 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants