@types/koa-hbs
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

Installation

npm install --save @types/koa-hbs

Summary

This package contains type definitions for koa-hbs (https://github.com/gilt/koa-hbs).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-hbs.

index.d.ts

/* =================== USAGE ===================

    import * as Koa from "koa";
....import hbs = require("koa-hbs");

    var app = new Koa();

    app.use(hbs.middleware({
        viewPath: __dirname + '/views'
    }));

    app.use(async (ctx, next) => {
        await ctx.render('main', {
            title: 'koa-hbs'
        });
    });

 =============================================== */

/// <reference types="koa" />

import * as Handlebars from "handlebars";
import * as Koa from "koa";

declare namespace Hbs {
    export interface Middleware {
        viewPath: string[] | string;
        handlebars?: Function | undefined;
        templateOptions?: {} | undefined;
        extname?: string | undefined;
        partialsPath?: string[] | string | undefined;
        defaultLayout?: string | undefined;
        layoutsPath?: string | undefined;
        contentHelperName?: string | undefined;
        blockHelperName?: string | undefined;
        disableCache?: boolean | undefined;
    }
}

declare class Hbs {
    constructor();
    middleware(opts: Hbs.Middleware): any;
    registerHelper: typeof Handlebars.registerHelper;
    SafeString: typeof Handlebars.SafeString;
    Utils: typeof Handlebars.Utils;
}

declare const hbs: Hbs;
export = hbs;

declare module "koa" {
    export interface Context {
        render(tpl: string, locals?: { [key: string]: any }): Promise<void>;
    }
}

Additional Details

Credits

These definitions were written by Jacob Malone, and Mudkip.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @types/koa-hbs

Weekly Downloads

43

Version

1.0.11

License

MIT

Unpacked Size

5.66 kB

Total Files

5

Last publish

Collaborators

  • types