Add types for mustache-express

This commit is contained in:
Dimitri Benin
2018-11-28 16:23:49 +01:00
parent 53d58bb442
commit 0f51eb8eea
4 changed files with 57 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for mustache-express 1.2
// Project: https://github.com/bryanburgers/node-mustache-express#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Cache } from 'lru-cache';
export = mustacheExpress;
declare function mustacheExpress(
partialsPath?: string,
partialsExt?: string
): mustacheExpress.ExpessEngine;
declare namespace mustacheExpress {
interface ExpessEngine {
(path: string, options: any, cb: (...args: any[]) => any): any;
cache: TemplateCache;
}
type TemplateCache = Cache<string, { name: string; data: string; partials: string[] }>;
}
@@ -0,0 +1,10 @@
import express = require('express');
import mustacheExpress = require('mustache-express');
const app = express();
app.engine('mustache', mustacheExpress());
app.engine('mustache', mustacheExpress('/partials'));
app.engine('mustache', mustacheExpress('/partials', '.mst'));
// $ExpectType Cache<string, { name: string; data: string; partials: string[]; }>
mustacheExpress().cache;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"mustache-express-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }