From 0510c2ebf70d5c4defd38c661c60413bdecea8f1 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 21 Dec 2016 01:11:40 +0800 Subject: [PATCH] [koa-pug] Meet types-2.0 (#13460) * Meet types-2.0 * Update index.d.ts * Update index.d.ts * Update index.d.ts --- koa-pug/index.d.ts | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/koa-pug/index.d.ts b/koa-pug/index.d.ts index e25a5bc6bf..836d7c88fe 100644 --- a/koa-pug/index.d.ts +++ b/koa-pug/index.d.ts @@ -5,20 +5,18 @@ import * as koa from "koa"; -export namespace Koa { - interface Context { - render(viewPath: string, locals?: Pug.PugLocals, overrideOpts?: Pug.PugCtxOptions, noCache?: boolean): void; - // tslint:disable-next-line:unified-signatures - render(pugStr: string, locals?: Pug.PugLocals, overrideOpts?: Pug.PugCtxOptions): void; - // tslint:disable-next-line:unified-signatures - render(pugStr: string, locals?: Pug.PugLocals, noCache?: boolean): void; - } -} -export class Pug { + +export = Pug; + + +/** main module */ +declare class Pug { constructor(options?: Pug.PugOptions); use(app: koa): void; } -export namespace Pug { + + +declare namespace Pug { export interface PugOptions { viewPath?: string; pretty?: boolean; @@ -35,3 +33,13 @@ export namespace Pug { } export interface PugLocals { [str: string]: any; } } + + + +/** plugin */ +declare module 'koa' { + interface Context { + render(viewPath: string, locals?: Pug.PugLocals, overrideOpts?: Pug.PugCtxOptions, noCache?: boolean): void; + render(viewPath: string, locals?: Pug.PugLocals, overrideOpts?: boolean): void; + } +}