tapio / live-server

A simple development http server with live reload capability.
http://tapiov.net/live-server/
4.41k stars 484 forks source link

TypeScript Definitions #348

Closed joshcummingsdesign closed 4 years ago

joshcummingsdesign commented 4 years ago

Hello 👋,

I noticed there were no type declarations on DefinitelyTyped.

Here's what I created so far

declare module 'live-server' {
  export interface LiveServerParams {
    /** Set the server port. Defaults to 8080. */
    port?: number;
    /**  Set the address to bind to. Defaults to 0.0.0.0 or process.env.IP. */
    host?: string;
    /** Set root directory that's being served. Defaults to cwd. */
    root?: string;
    /** When false, it won't load your browser by default. */
    open?: boolean;
    /** Comma-separated string for paths to ignore. */
    ignore?: string;
    /** When set, serve this file (server root relative) for every 404 (useful for single-page applications). */
    file?: string;
    /** Waits for all changes, before reloading. Defaults to 0 sec. */
    wait?: number;
    /** Mount a directory to a route. */
    mount?: string[][];
    /** 0 = errors only, 1 = some, 2 = lots */
    logLevel?: number;
    /** Takes an array of Connect-compatible middleware that are injected into the server middleware stack. */
    middleware?: Function[];
  }

  export function start(params: LiveServerParams): void;
}

I'd be happy to open a PR unless there is something I'm missing or someone is already working on this issue.

All the best, and thanks for this project!

joshcummingsdesign commented 4 years ago

Opened a PR in DefinitelyTyped. Feedback welcome.

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/45621

joshcummingsdesign commented 4 years ago

Type definitions merged.