Merge pull request #34004 from AndrewLeedham/master

[@types/node-fetch] Make systemError optional
This commit is contained in:
Sheetal Nandi
2019-03-20 10:44:52 -07:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@@ -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" />
@@ -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;

View File

@@ -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');
}