Skip to content

Commit cd27e9a

Browse files
authored
Merge pull request #446 from Ovyerus/fix-constructor-type
Fix constructor options in Typescript definitions
2 parents 06568ed + 4bde68e commit cd27e9a

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

index.d.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ import * as http from 'http';
99

1010
export = FormData;
1111

12-
interface Options {
12+
// Extracted because @types/node doesn't export interfaces.
13+
interface ReadableOptions {
14+
highWaterMark?: number;
15+
encoding?: string;
16+
objectMode?: boolean;
17+
read?(this: stream.Readable, size: number): void;
18+
destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void;
19+
autoDestroy?: boolean;
20+
}
21+
22+
interface Options extends ReadableOptions {
1323
writable?: boolean;
1424
readable?: boolean;
1525
dataSize?: number;

lib/form_data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ util.inherits(FormData, CombinedStream);
2525
*/
2626
function FormData(options) {
2727
if (!(this instanceof FormData)) {
28-
return new FormData();
28+
return new FormData(options);
2929
}
3030

3131
this._overheadLength = 0;

0 commit comments

Comments
 (0)