# @types/koa-hbs

> TypeScript definitions for koa-hbs

Latest version **1.0.12** (published 2025-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/koa-hbs
pnpm add @types/koa-hbs
yarn add @types/koa-hbs
bun add @types/koa-hbs
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2025-10-24 |
| First published | 2016-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51450 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/koa-hbs
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-hbs
- npm.io page: https://npm.io/package/@types/koa-hbs

## Dependencies (2)

- [@types/koa](https://npm.io/package/@types/koa.md) *
- [handlebars](https://npm.io/package/handlebars.md) ^4.1.0

## Recent versions

- 1.0.12 (latest) — 2025-10-24
- 1.0.11 (ts5.1) — 2023-11-21
- 1.0.7 (ts3.6) — 2021-07-08
- 1.0.6 (ts3.4) — 2020-09-14
- 1.0.5 (ts2.4) — 2019-03-07
- 1.0.2 (ts2.2) — 2017-06-02
- 1.0.10 — 2023-11-07
- 1.0.9 — 2023-10-18
- 1.0.8 — 2023-09-14
- 1.0.4 — 2017-08-21
- 1.0.3 — 2017-07-12
- 1.0.1 — 2017-02-21
- 1.0.0 — 2017-02-14
- 2.0.4 — 2016-11-21
- 2.0.3 — 2016-09-19
- … 2 more at https://npm.io/package/@types/koa-hbs/versions

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-hbs/index.d.ts)
````ts
/* =================== USAGE ===================

    import Koa = require("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
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa), [handlebars](https://npmjs.com/package/handlebars)

# Credits
These definitions were written by [Jacob Malone](https://github.com/jcbmln), and [Mudkip](https://github.com/mudkipme).

---
_Source: https://npm.io/package/@types/koa-hbs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
