From 813035a67ff6e52846da23f58fe4739cecc60161 Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Thu, 11 Jun 2015 21:35:17 +0200 Subject: [PATCH] Add type definition for the mime property exposed on serve-static. JS source of serve-static exposes npm module mime, see: https://github.com/expressjs/serve-static/blob/master/index.js#L122 --- serve-static/serve-static-tests.ts | 6 ++++++ serve-static/serve-static.d.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/serve-static/serve-static-tests.ts b/serve-static/serve-static-tests.ts index 6b16e842b2..36d2761cdd 100644 --- a/serve-static/serve-static-tests.ts +++ b/serve-static/serve-static-tests.ts @@ -18,3 +18,9 @@ app.use(serveStatic('/3', { res.setHeader('Server', 'server-static middleware'); } })); + +serveStatic.mime.define({ + 'application/babylon': ['babylon'], + 'application/babylonmeshdata': ['babylonmeshdata'], + 'application/fx': ['fx'] +}); \ No newline at end of file diff --git a/serve-static/serve-static.d.ts b/serve-static/serve-static.d.ts index b116d43848..f7d7e502f1 100644 --- a/serve-static/serve-static.d.ts +++ b/serve-static/serve-static.d.ts @@ -11,6 +11,7 @@ =============================================== */ /// +/// declare module "serve-static" { import express = require('express'); @@ -75,5 +76,11 @@ declare module "serve-static" { setHeaders?: (res: express.Response, path: string, stat: any) => any; }): express.Handler; + import m = require('mime'); + + module serveStatic { + var mime: typeof m; + } + export = serveStatic; }