From 0b757f37371474da63db341b831d83539df28df6 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 10 Sep 2019 15:57:17 +0100 Subject: [PATCH] Expose the DOM Body interface globally (#2903) --- js/body_test.ts | 4 ++-- js/globals.ts | 2 ++ js/lib.deno_runtime.d.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/js/body_test.ts b/js/body_test.ts index f2daf725e6..ec76e90720 100644 --- a/js/body_test.ts +++ b/js/body_test.ts @@ -3,11 +3,11 @@ import { test, testPerm, assertEquals, assert } from "./test_util.ts"; // just a hack to get a body object // eslint-disable-next-line @typescript-eslint/no-explicit-any -function buildBody(body: any): domTypes.Body { +function buildBody(body: any): Body { const stub = new Request("", { body: body }); - return stub as domTypes.Body; + return stub as Body; } const intArrays = [ diff --git a/js/globals.ts b/js/globals.ts index 6de8a5d89d..e9479b4a57 100644 --- a/js/globals.ts +++ b/js/globals.ts @@ -99,6 +99,8 @@ window.crypto = (csprng as unknown) as Crypto; window.Blob = blob.DenoBlob; export type Blob = blob.DenoBlob; +export type Body = domTypes.Body; + window.File = domFile.DenoFile as domTypes.DomFileConstructor; export type File = domTypes.DomFile; diff --git a/js/lib.deno_runtime.d.ts b/js/lib.deno_runtime.d.ts index 6027f39b85..6ddf29c6ca 100644 --- a/js/lib.deno_runtime.d.ts +++ b/js/lib.deno_runtime.d.ts @@ -1313,6 +1313,7 @@ declare const removeEventListener: ( ) => void; declare type Blob = blob.DenoBlob; +declare type Body = domTypes.Body; declare type File = domTypes.DomFile; declare type CustomEventInit = customEvent.CustomEventInit; declare type CustomEvent = customEvent.CustomEvent;