Merge pull request #12695 from tdolsen/types-2.0

Add type definition for express-formidable
This commit is contained in:
Andy
2016-11-16 11:23:26 -08:00
committed by GitHub
3 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import express = require("express");
import expform = require("express-formidable");
const app = express();
app.use("/form1", expform());
app.use("/form2", expform({
encoding: "utf-8",
uploadDir: "./uploads",
keepExtensions: true,
type: "multipart",
maxFieldsSize: 3 * 1024 * 1024,
maxFields: 50,
hash: "sha1",
multiples: true
}));

21
express-formidable/index.d.ts vendored Normal file
View File

@@ -0,0 +1,21 @@
// Type definitions for express-formidable 1.0.0
// Project: https://github.com/noraesae/express-formidable
// Definitions by: Torkild Dyvik Olsen <https://github.com/tdolsen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { RequestHandler } from "express";
interface ExpressFormidableOptions {
encoding?: string;
uploadDir?: string;
keepExtensions?: boolean;
type?: "multipart" | "urlencoded";
maxFieldsSize?: number;
maxFields?: number;
hash?: boolean | "sha1" | "md5";
multiples?: boolean;
}
declare function ExpressFormidable(options?: ExpressFormidableOptions): RequestHandler;
export = ExpressFormidable;

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-formidable-tests.ts"
]
}