Skip to content

Add TypeScript types #4

@nathanvogel

Description

@nathanvogel

Hi,
I used this library (thanks!) and made some types, so I thought I'd share (sorry for the lack of PR / DefinitelyTyped PR).
Cheers

My node-rdp.d.ts:

declare module "node-rdp" {
  interface RDPOptions {
    /**
     * address to connect to (defaults to the empty string '')
     */
    address?: string;
    /**
     * username to use for connection (defaults to the empty string '')
     */
    username?: string;
    /**
     * password to use for connection (defaults to the empty string '')
     */
    password?: string;
    /**
     * deletes credentials and temporary files after disconnection (defaults to true)
     */
    deleteCredentialsAfter?: boolean;
    /**
     * enables a "safe mode" for handling the connection (see caveats) (defaults to false)
     */
    safeMode?: boolean;
    /**
     * auto-reconnect after an erroneous disconnection (defaults to true)
     */
    autoReconnect?: boolean;
    /**
     * launch as a fullscreen application (defaults to true)
     */
    fullscreen?: boolean;
    /**
     * color depth in bits (defaults to 32)
     */
    colors?: number;
    /**
     * determines if the connection must be compressed (defaults to true)
     */
    compression?: boolean;
    /**
     * the type of the connection, can be one of 'modem', 'low', 'satellite', 'high', 'wan', 'lan', 'auto' (defaults to 'auto')
     */
    connectionType?:
      | "modem"
      | "low"
      | "satellite"
      | "high"
      | "wan"
      | "lan"
      | "auto";
    /**
     * set some connection parameters automatically depending on the detected network type (defaults to true)
     */
    networkAutoDetect?: boolean;
    /**
     * set some connection parameters automatically depending on the detected bandwidth type (defaults to true)
     */
    bandwidthAutoDetect?: boolean;
    /**
     * show the wallpaper on the remote computer (defaults to false)
     */
    showWallpaper?: boolean;
    /**
     * enable font smoothing (defaults to false)
     */
    fontSmoothing?: boolean;
    /**
     * enable desktop composition, useful for Aero (defaults to false)
     */
    desktopComposition?: boolean;
    /**
     * show full window contents while dragging (defaults to false)
     */
    showDraggedWindow?: boolean;
    /**
     * show menu animations (defaults to false)
     */
    showMenuAnimations?: boolean;
    /**
     * show themes (defaults to true)
     */
    showThemes?: boolean;
    /**
     * show blinking cursor on input controls (defaults to true)
     */
    showBlinkingCursor?: boolean;
    /**
     * determine which audio stream is played, can be one of 'local', 'remote', 'none' (defaults to 'local')
     */
    audioPlayMode?: "local" | "remove" | "none";
    /**
     * enable capturing audio on the local computer (defaults to false)
     */
    audioCaptureMode?: boolean;
    /**
     * enable local printers on the remote computer (defaults to true)
     */
    enableLocalPrinters?: boolean;
    /**
     * enable local COM ports on the remote computer (defaults to false)
     */
    enableLocalCOMPorts?: boolean;
    /**
     * enable local smart cards on the remote computer (defaults to true)
     */
    enableSmartCards?: boolean;
    /**
     * enable clipboard sharing between the local and remote computers (defaults to true)
     */
    enableClipboard?: boolean;
    /**
     * determine a subset of Plug And Play devices (separated by a semi-colon ;) based on the specified HIDs or the wildcard * (defaults to the empty string '')
     */
    enablePlugAndPlayDevices?: string;
    /**
     * determine a subset of local drives (separated by a semi-colon ;) for use on the remote computer, based on the labels or the wildcard * (defaults to the empty string '')
     */
    enableDrives?: string;
    /**
     * enable local Point of Service on the remote computer (defaults to false)
     */
    enablePos?: boolean;
    /**
     * application to launch upon connection (defaults to the empty string '')
     */
    launch?: string;
    /**
     * working directory for the application to be launched upon connection (defaults to the empty string '')
     */
    launchWorkingDirectory?: string;
  }

  /**
   * The return value will be a Promise object that will be resolved as soon as the connection is terminated.
   *
   * @param options
   */
  function rdp(options: RDPOptions): Promise<undefined>;

  export default rdp;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions