Skip to content

Commit 286d57a

Browse files
committed
Improve how to re-export types in index
1 parent 0d6322e commit 286d57a

File tree

10 files changed

+21
-40
lines changed

10 files changed

+21
-40
lines changed

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Constants from "./constants";
22
import Resource from "./resource";
33
import { PartialVideomailClientOptions } from "./types/options";
4-
import Videomail from "./types/Videomail";
4+
import { Videomail } from "./types/Videomail";
55
import Despot from "./util/Despot";
66
import createError from "./util/error/createError";
77
import mergeWithDefaultOptions from "./util/options/mergeWithDefaultOptions";

src/index.ts

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
import VideomailClient from "./client";
2-
import { Command, VideomailCommandArgs } from "./types/command";
3-
import DeliveryRecord from "./types/DeliveryRecord";
4-
import { EmailAddress, EmailAddresses } from "./types/EmailAddress";
5-
import { FullVideomailErrorData, VideomailErrorData } from "./types/error";
6-
import VideomailEvents, { VideomailPreviewParams } from "./types/events";
7-
import { VideomailClientOptions } from "./types/options";
8-
import RecordingStats from "./types/RecordingStats";
9-
import Videomail, { PartialVideomail } from "./types/Videomail";
10-
import { VideoType, VideoTypeType } from "./types/VideoType";
112

12-
export type {
13-
Command,
14-
DeliveryRecord,
15-
EmailAddress,
16-
EmailAddresses,
17-
FullVideomailErrorData,
18-
PartialVideomail,
19-
RecordingStats,
20-
Videomail,
21-
VideomailClientOptions,
22-
VideomailCommandArgs,
23-
VideomailErrorData,
24-
VideomailEvents,
25-
VideomailPreviewParams,
26-
VideoTypeType,
27-
};
3+
export type { Command } from "./types/command";
4+
export type DeliveryRecord = "./types/DeliveryRecord";
5+
export type { VideomailCommandArgs } from "./types/command";
6+
export type { EmailAddress, EmailAddresses } from "./types/EmailAddress";
7+
export type { FullVideomailErrorData, VideomailErrorData } from "./types/error";
8+
export type { VideomailEvents, VideomailPreviewParams } from "./types/events";
9+
export type { VideomailClientOptions } from "./types/options";
10+
export type RecordingStats = "./types/RecordingStats";
11+
export type { PartialVideomail, Videomail } from "./types/Videomail";
2812

29-
export { VideomailClient, VideoType };
13+
export { VideomailClient };

src/resource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { version as videomailClientVersion } from "./../package.json";
66
import Constants from "./constants";
77
import { FullVideomailErrorData } from "./types/error";
88
import { VideomailClientOptions } from "./types/options";
9-
import Videomail, { PartialVideomail } from "./types/Videomail";
9+
import { PartialVideomail, Videomail } from "./types/Videomail";
1010
import createError from "./util/error/createError";
1111
import HTTPVideomailError from "./util/error/HTTPVideomailError";
1212
import VideomailError from "./util/error/VideomailError";

src/stories/static/json/videomail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Used for mocked MSW responses in storybook
22

3-
import Videomail from "../../../types/Videomail";
3+
import { Videomail } from "../../../types/Videomail";
44

55
const videomailExample: Videomail = {
66
subject: "Hamster on Speed",

src/types/Videomail.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import VideoFormat from "./VideoFormat";
77

88
// Remember, only primitive types are supported.
99
// LevelDB can't store for example Sets or Maps
10-
interface Videomail {
10+
export interface Videomail {
1111
// First, typical email typings
1212
subject?: string;
1313
body?: string;
@@ -72,5 +72,3 @@ interface Videomail {
7272
}
7373

7474
export type PartialVideomail = PartialDeep<Videomail>;
75-
76-
export default Videomail;

src/types/events/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Response from "superagent/lib/node/response";
33
import VideomailError from "../../util/error/VideomailError";
44
import { FormReadyParams } from "../../wrappers/container";
55
import RecordingStats from "../RecordingStats";
6-
import Videomail from "../Videomail";
6+
import { Videomail } from "../Videomail";
77

88
export interface UserMediaReadyParams {
99
switchingFacingMode?: ConstrainDOMString | undefined;
@@ -56,7 +56,7 @@ export interface InvalidParams {
5656
invalidData?: Record<string, string>;
5757
}
5858

59-
interface VideomailEvents {
59+
export interface VideomailEvents {
6060
// when about to ask for webcam permissions
6161
ASKING_WEBCAM_PERMISSION: () => void;
6262
// encoding video
@@ -143,5 +143,3 @@ interface VideomailEvents {
143143
// document just became visible
144144
VISIBLE: () => void;
145145
}
146-
147-
export default VideomailEvents;

src/util/Despot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createNanoEvents } from "nanoevents";
22

3-
import VideomailEvents from "../types/events";
3+
import { VideomailEvents } from "../types/events";
44
import { VideomailClientOptions } from "../types/options";
55
import VideomailError from "./error/VideomailError";
66
import pretty from "./pretty";

src/wrappers/container.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ShowParams, StartOverParams } from "../client";
77
import Resource from "../resource";
88
import { ErrorParams } from "../types/events";
99
import { VideomailClientOptions } from "../types/options";
10-
import Videomail from "../types/Videomail";
10+
import { Videomail } from "../types/Videomail";
1111
import Despot from "../util/Despot";
1212
import createError from "../util/error/createError";
1313
import getBrowser from "../util/getBrowser";
@@ -20,6 +20,7 @@ import pretty from "../util/pretty";
2020
import Buttons from "./buttons";
2121
import Form, { FormInputs, FormMethod, FormMethodType } from "./form";
2222
import Visuals from "./visuals";
23+
2324
interface BuildOptions {
2425
playerOnly?: boolean;
2526
replayParentElementId?: string | undefined;

src/wrappers/form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import getFormData from "get-form-data";
22

33
import { ErrorParams, VideomailPreviewParams } from "../types/events";
44
import { VideomailClientOptions } from "../types/options";
5-
import Videomail, { PartialVideomail } from "../types/Videomail";
5+
import { PartialVideomail, Videomail } from "../types/Videomail";
66
import Despot from "../util/Despot";
77
import createError from "../util/error/createError";
88
import hideElement from "../util/html/hideElement";

src/wrappers/visuals/replay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VideomailPreviewParams } from "../../types/events";
22
import { VideomailClientOptions } from "../../types/options";
3-
import Videomail from "../../types/Videomail";
3+
import { Videomail } from "../../types/Videomail";
44
import { VideoType } from "../../types/VideoType";
55
import Despot from "../../util/Despot";
66
import createError from "../../util/error/createError";

0 commit comments

Comments
 (0)