diff --git a/koa-pug/index.d.ts b/koa-pug/index.d.ts new file mode 100644 index 0000000000..e25a5bc6bf --- /dev/null +++ b/koa-pug/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for koa-pug 3.0 +// Project: https://github.com/chrisyip/koa-pug +// Definitions by: Xavier Stouder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +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 { + constructor(options?: Pug.PugOptions); + use(app: koa): void; +} +export namespace Pug { + export interface PugOptions { + viewPath?: string; + pretty?: boolean; + compileDebug?: boolean; + debug?: boolean; + locals?: PugLocals; + noCache?: boolean; + helperPath?: string | Array; + basedir?: string; + app?: koa; + } + export interface PugCtxOptions extends PugOptions { + fromString: boolean; + } + export interface PugLocals { [str: string]: any; } +} diff --git a/koa-pug/koa-pug-tests.ts b/koa-pug/koa-pug-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/koa-pug/tsconfig.json b/koa-pug/tsconfig.json new file mode 100644 index 0000000000..21d8c4f990 --- /dev/null +++ b/koa-pug/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-pug-tests.ts" + ] +} diff --git a/koa-pug/tslint.json b/koa-pug/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/koa-pug/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }