Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#34004 from AndrewLeedham/master
Browse files Browse the repository at this point in the history
[@types/node-fetch] Make systemError optional
  • Loading branch information
sheetalkamat authored Mar 20, 2019
2 parents 8346cd7 + 576c81e commit 0915e9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion types/node-fetch/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Niklas Lindgren <https://github.com/nikcorg>
// Vinay Bedre <https://github.com/vinaybedre>
// Antonio Román <https://github.com/kyranet>
// Andrew Leedham <https://github.com/AndrewLeedham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />
Expand Down Expand Up @@ -134,7 +135,7 @@ export class Body {

export class FetchError extends Error {
name: "FetchError";
constructor(message: string, type: string, systemError: string);
constructor(message: string, type: string, systemError?: string);
type: string;
code?: string;
errno?: string;
Expand Down
7 changes: 6 additions & 1 deletion types/node-fetch/node-fetch-tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fetch, { Headers, Request, RequestInit, Response } from 'node-fetch';
import fetch, { Headers, Request, RequestInit, Response, FetchError } from 'node-fetch';
import { Agent } from "http";

function test_fetchUrlWithOptions() {
Expand Down Expand Up @@ -82,3 +82,8 @@ function test_isRedirect() {
fetch.isRedirect(301);
fetch.isRedirect(201);
}

function test_FetchError() {
new FetchError('message', 'type', 'systemError');
new FetchError('message', 'type');
}

0 comments on commit 0915e9e

Please sign in to comment.