1.0.11 • Published 2 years ago

@types/koa-hbs v1.0.11

Weekly downloads
212
License
MIT
Repository
github
Last release
2 years ago

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

// Type definitions for koa-hbs v1.x
// Project: https://github.com/gilt/koa-hbs
// Definitions by: Jacob Malone <https://github.com/jcbmln>, Mudkip <https://github.com/mudkipme>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

/* =================== 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 Koa from "koa";
import * as Handlebars from "handlebars";

declare namespace Hbs {
    export interface Middleware {
        viewPath: Array<string> | string,
        handlebars?: Function | undefined,
        templateOptions?: {} | undefined,
        extname?: string | undefined,
        partialsPath?: Array<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.

1.0.9

2 years ago

1.0.8

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.7

4 years ago

1.0.6

5 years ago

1.0.5

6 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago