From 9e9949c5b0ababa9207ec1f5d916feeb6ae49e6f Mon Sep 17 00:00:00 2001 From: Andrew Leedham Date: Tue, 19 Mar 2019 16:03:49 +0000 Subject: [PATCH 1/2] fix(node-fetch): make systemError optional --- types/node-fetch/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 03ae639d26..8883dc1b9d 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -4,6 +4,7 @@ // Niklas Lindgren // Vinay Bedre // Antonio Román +// Andrew Leedham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -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; From 576c81e41be1cae94d85ccfc955aaf86afc80f3d Mon Sep 17 00:00:00 2001 From: Andrew Leedham Date: Tue, 19 Mar 2019 16:16:37 +0000 Subject: [PATCH 2/2] test(node-fetch): added FetchError test --- types/node-fetch/node-fetch-tests.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/node-fetch/node-fetch-tests.ts b/types/node-fetch/node-fetch-tests.ts index d35114f60a..165ac24800 100644 --- a/types/node-fetch/node-fetch-tests.ts +++ b/types/node-fetch/node-fetch-tests.ts @@ -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() { @@ -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'); +}