We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be nice to include typescript definitions. Something like this:
declare module 'quip' { import { IncomingMessage, ServerResponse } from 'http'; type StatusCode = | 200 | 201 | 202 | 204 | 301 | 302 | 304 | 400 | 401 | 403 | 404 | 405 | 409 | 410 | 500; type RedirectionCode = 301 | 302; type ContentType = | 'text/plain' | 'text/html' | 'application/xhtml+xml' | 'text/css' | 'text/xml' | 'application/atom+xml' | 'application/rss+xml' | 'application/javascript' | 'application/json'; interface QuipExtensions { status<T = any>(code: StatusCode): QuipResponse<T>; headers<T = any>(headers: { [key: string]: string }): QuipResponse<T>; ok<T = any>(): QuipResponseFunction<T>; created<T = any>(): QuipResponseFunction<T>; accepted<T = any>(): QuipResponseFunction<T>; noContent<T = any>(): QuipResponse<T>; moved<T = any>(loc: string): QuipResponse<T>; redirect<T = any>(loc: string, code?: RedirectionCode): QuipResponse<T>; found<T = any>(loc: string): QuipResponse<T>; notModified<T = any>(): QuipResponse<T>; badRequest<T = any>(): QuipResponseFunction<T>; unauthorized<T = any>(): QuipResponseFunction<T>; forbidden<T = any>(): QuipResponseFunction<T>; notFound<T = any>(): QuipResponseFunction<T>; notAllowed<T = any>(): QuipResponseFunction<T>; conflict<T = any>(): QuipResponseFunction<T>; gone<T = any>(): QuipResponseFunction<T>; error<T = any>(): QuipResponseFunction<T>; text<T = string>(data?: T): QuipResponse<T>; plain<T = string>(data?: T): QuipResponse<T>; html<T = string>(data?: T): QuipResponse<T>; xhtml<T = string>(data?: T): QuipResponse<T>; css<T = string>(data?: T): QuipResponse<T>; xml<T = string>(data?: T): QuipResponse<T>; atom<T = string>(data?: T): QuipResponse<T>; rss<T = string>(data?: T): QuipResponse<T>; javascript<T = string>(data?: T): QuipResponse<T>; json<T = any>(data?: T): QuipResponse<T>; mime<T = any>(type: ContentType, data?: T): QuipResponse<T>; jsonp<T = any>(callback: string, data?: T): QuipResponse<T>; send<T = any>(data?: T): QuipResponse<T>; } type QuipResponseFunction<T> = (data?: T) => QuipResponse<T>; export type QuipResponse<T = any> = ServerResponse & QuipExtensions & { body?: T }; interface Quip { <T = any>(req: IncomingMessage, res: ServerResponse, next: Function): void; } const quip: Quip; export default quip; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be nice to include typescript definitions. Something like this:
The text was updated successfully, but these errors were encountered: