4.3.3 • Published 7 months ago

@types/koa-ejs v4.3.3

Weekly downloads
1,387
License
MIT
Repository
github
Last release
7 months ago

Installation

npm install --save @types/koa-ejs

Summary

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

Details

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

index.d.ts

// Type definitions for koa-ejs 4.3
// Project: https://github.com/koajs/ejs
// Definitions by: Matt B <https://github.com/mattb-prg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

import * as Koa from "koa";
import * as Ejs from 'ejs';

declare module "Koa" {
  interface ExtendableContext {
    /** Properties values can be of any format; e.g. string, number, boolean, or even nested objects of these types */
    render: (template: string, properties?: {[name: string]: any}) => Promise<string>;
  }
}

/**
 *  Adds render method to the app context.
 */
declare function koaEjs(app: Koa, settings: koaEjs.Settings): void;

declare namespace koaEjs {
    interface Settings {
        /** View root directory */
        root: string;
        /** Global layout file, default is layout, set false to disable layout. */
        layout?: string | false;
        /** Filename extension for the views. Defaults to html. */
        viewExt?: string;
        /** Cache compiled templates */
        cache?: boolean;
        /** Log debug messages. */
        debug?: boolean;
        /** Character to use with angle brackets for open / close (default %). */
        delimiter?: string;
        /** When true, EJS will use an async function for rendering. Depends on async/await support in the JS runtime */
        async?: boolean;
        /** When false, EJS  will only return the HTML, not write to the resposne. Defaults to true */
        writeResp?: boolean;
    }

    /**
     * The ejs API.
     */
    const ejs: typeof Ejs;
}

export = koaEjs;

Additional Details

Credits

These definitions were written by Matt B.

4.3.2

7 months ago

4.3.1

8 months ago

4.3.3

7 months ago

4.3.0

3 years ago

4.2.4

3 years ago

4.2.3

3 years ago

4.2.2

4 years ago

4.2.1

4 years ago

4.2.0

5 years ago