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

Add declaration file for Typescript support #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgrisole
Copy link

@mgrisole mgrisole commented Mar 8, 2020

No description provided.

@bencevans
Copy link
Owner

Thanks for opening the PR. Are you aware of something we could add to the CI to ensure these declarations do not slip behind when future work is done?

@tupizz
Copy link

tupizz commented Dec 29, 2020

updating:

declare module 'screenshot-desktop' {
  declare interface Display {
    width: number;
    height: number;
    name: string;
    id: string;
    offsetX: number;
    offsetY: number;
    primary: boolean;
    crop: string;
  }

  declare interface Options {
    /**
    Optional. On which screen you want to take the picture.
    @default ""
  */
    screen?: string;

    /**
    Optional. Absolute or relative path to save output.
    @default ""
  */
    filename?: string;

    /**
    @default ""
  */
    format?: 'png' | 'jpg';

    /**
  linuxLibrary. Which library to use. Note that scrot does not support format or screen selection.
  Linux only
  */
    linuxLibrary?: 'scrot' | 'imagemagick';
  }

  declare namespace screenshot {
    /**
    @returns An array of Display.
    */
    function listDisplays(): Promise<Display[]>;

    /**
    @returns An array of Buffers, one for each screen.
    */
    function all(): Promise<Buffer[]>;
  }

  /**
    Screenshot-desktop capture function
    @returns The output file location.
  */
  declare function screenshot(options?: Options): Promise<string>;

  export default screenshot;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants