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

TypeScript typings #87

Closed
dbartholomae opened this issue May 12, 2019 · 1 comment
Closed

TypeScript typings #87

dbartholomae opened this issue May 12, 2019 · 1 comment

Comments

@dbartholomae
Copy link

Hi there,

I couldn't find any TypeScript typings and wrote these:

declare module 'serve-handler' {
  import { IncomingMessage, ServerResponse } from 'http'

  export interface IHeader {
    key: string
    value: string
  }

  export interface IRedirect {
    source: string
    destination: string
  }

  export interface IServeHandlerOptions {
    public?: string
    cleanUrls?: boolean | string[],
    rewrites?: IRedirect[],
    redirects?: IRedirect[],
    headers?: IHeader[],
    directoryListing?: boolean | string[],
    unlisted?: string[],
    trailingSlash?: boolean,
    renderSingle?: boolean,
    symlinks?: boolean
  }

  export default function (request: IncomingMessage, response: ServerResponse, options?: IServeHandlerOptions): void
}

Hope these will help others using this library with TypeScript!

@TooTallNate
Copy link
Member

Thanks for the tip! There's also @types/serve-handler on npm.

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

No branches or pull requests

2 participants