From e1af82581c65e3fd1ea058ebf2fe0223d16678ae Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Wed, 11 Apr 2018 19:09:58 +0900 Subject: [PATCH] Export universal `CreateBody` types --- src/body/universal.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/body/universal.ts b/src/body/universal.ts index 21dafcb..cb84220 100644 --- a/src/body/universal.ts +++ b/src/body/universal.ts @@ -2,13 +2,19 @@ import { Readable } from 'stream' // tslint:disable-line import { createBody as createNodeBody, CreateBody as CreateNodeBody, Body as NodeBody } from './node' import { CreateBody as CreateBrowserBody, Body as BrowserBody } from './browser' -export { NodeBody as Body } +/** + * Export mapped `Body` (e.g. `NodeBody` or `BrowserBody`). + */ +export { NodeBody as Body, NodeBody, BrowserBody } -export type CreateBodyFn = (value?: CreateNodeBody | CreateBrowserBody) => NodeBody | BrowserBody +/** + * Supported `CreateBody` types. + */ +export type CreateBody = CreateNodeBody | CreateBrowserBody /** * This function is changed at bundle time by tools like Browserify to * `./browser`. Unfortunately TypeScript doesn't support this so we do an * interesting hack by intersecting the valid return classes. */ -export const createBody: CreateBodyFn = createNodeBody +export const createBody: (value?: CreateBody) => NodeBody | BrowserBody = createNodeBody