mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Added declarations for content-disposition (#13191)
* Added declarations for content-disposition * Fixed missing semicolon * Added empty function * Made ContentDisposition an interface instead of a class * Filename may be undefined but not void
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import contentDisposition = require("content-disposition");
|
||||
|
||||
const noParams = contentDisposition();
|
||||
const withFilenameNoOptions = contentDisposition("EURO rates.txt");
|
||||
const withFilenameAndOptions = contentDisposition("€ rates.txt", { type: "attachment", fallback: "EURO rates.txt" });
|
||||
const noFilename = contentDisposition(undefined, { type: "attachment", fallback: true });
|
||||
|
||||
const res = contentDisposition.parse('attachment; filename="EURO rates.txt"');
|
||||
const type = res.type;
|
||||
const parameters = res.parameters;
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for content-disposition 0.5
|
||||
// Project: https://github.com/jshttp/content-disposition
|
||||
// Definitions by: Stefan Reichel <https://github.com/bomret>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace contentDisposition {
|
||||
export interface ContentDisposition {
|
||||
type: string;
|
||||
parameters: any;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
type?: string;
|
||||
fallback?: string | boolean;
|
||||
}
|
||||
|
||||
export function parse(contentDispositionHeader: string): ContentDisposition;
|
||||
}
|
||||
|
||||
declare function contentDisposition(): string;
|
||||
declare function contentDisposition(filename: undefined, options: contentDisposition.Options): string;
|
||||
declare function contentDisposition(filename: string, options?: contentDisposition.Options): string;
|
||||
|
||||
export = contentDisposition;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"content-disposition-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user