Skip to content

Commit bbde0ca

Browse files
committed
chore: fail on docs warnings and export missing types
1 parent 299c683 commit bbde0ca

File tree

12 files changed

+41
-32
lines changed

12 files changed

+41
-32
lines changed

docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
typedoc
5+
typedoc --treatWarningsAsErrors
66

77
# We need to fix the links in the generated markdown files.
88
# Typedoc generates anchors for properties in tables which can collide with anchors for types.

packages/browser-sdk/src/client.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import {
1313
RequestFeedbackOptions,
1414
} from "./feedback/feedback";
1515
import * as feedbackLib from "./feedback/ui";
16-
import { ToolbarPosition } from "./toolbar/Toolbar";
1716
import { API_BASE_URL, APP_BASE_URL, SSE_REALTIME_BASE_URL } from "./config";
1817
import { BucketContext, CompanyContext, UserContext } from "./context";
1918
import { HookArgs, HooksManager } from "./hooksManager";
2019
import { HttpClient } from "./httpClient";
2120
import { Logger, loggerWithPrefix, quietConsoleLogger } from "./logger";
2221
import { showToolbarToggle } from "./toolbar";
22+
import { ToolbarPosition } from "./ui/types";
2323

2424
const isMobile = typeof window !== "undefined" && window.innerWidth < 768;
2525
const isNode = typeof document === "undefined"; // deno supports "window" but not "document" according to https://remix.run/docs/en/main/guides/gotchas
@@ -145,7 +145,7 @@ export type PayloadContext = {
145145
/**
146146
* BucketClient configuration.
147147
*/
148-
interface Config {
148+
export interface Config {
149149
/**
150150
* Base URL of Bucket servers.
151151
*/
@@ -482,7 +482,6 @@ export class BucketClient {
482482
/**
483483
* Add a hook to the client.
484484
*
485-
* @param hook Hook to add.
486485
* @returns A function to remove the hook.
487486
*/
488487
on<THookType extends keyof HookArgs>(
@@ -496,7 +495,6 @@ export class BucketClient {
496495
/**
497496
* Remove a hook from the client.
498497
*
499-
* @param hook Hook to add.
500498
* @returns A function to remove the hook.
501499
*/
502500
off<THookType extends keyof HookArgs>(

packages/browser-sdk/src/feedback/feedback.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export type RequestFeedbackData = Omit<
6464
* copy of the feedback in your own application or CRM.
6565
*
6666
* @param {Object} data
67-
* @param data.
6867
*/
6968
onAfterSubmit?: (data: FeedbackSubmission) => void;
7069

packages/browser-sdk/src/hooksManager.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { CheckEvent, RawFeatures } from "./feature/features";
22
import { CompanyContext, UserContext } from "./context";
33

4-
/**
5-
* @internal
6-
*/
74
export interface HookArgs {
85
configCheck: CheckEvent;
96
enabledCheck: CheckEvent;

packages/browser-sdk/src/index.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
export type { Feature, InitOptions, ToolbarOptions } from "./client";
2-
export { BucketClient } from "./client";
1+
export type {
2+
Feature,
3+
FeatureRemoteConfig,
4+
InitOptions,
5+
ToolbarOptions,
6+
} from "./client";
7+
export { BucketClient, Config } from "./client";
38
export type { BucketContext, CompanyContext, UserContext } from "./context";
9+
export type {
10+
Position,
11+
Offset,
12+
DialogPlacement,
13+
PopoverPlacement,
14+
ToolbarPosition,
15+
} from "./ui/types";
416
export type {
517
CheckEvent,
618
FallbackFeatureOverride,
19+
FetchedFeature,
720
RawFeature,
821
RawFeatures,
922
} from "./feature/features";
@@ -28,6 +41,6 @@ export type {
2841
OnScoreSubmitResult,
2942
OpenFeedbackFormOptions,
3043
} from "./feedback/ui/types";
31-
export type { TrackEvent } from "./hooksManager";
44+
export type { HookArgs, TrackEvent } from "./hooksManager";
3245
export type { Logger } from "./logger";
3346
export { feedbackContainerId, propagatedEvents } from "./ui/constants";

packages/browser-sdk/src/toolbar/Toolbar.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,17 @@ import { BucketClient } from "../client";
1111
import { toolbarContainerId } from "../ui/constants";
1212
import { Dialog, DialogContent, DialogHeader, useDialog } from "../ui/Dialog";
1313
import { Logo } from "../ui/icons/Logo";
14-
import { DialogPlacement, Offset } from "../ui/types";
1514
import { parseUnanchoredPosition } from "../ui/utils";
1615

1716
import { FeatureSearch, FeaturesTable } from "./Features";
1817
import styles from "./index.css?inline";
18+
import { ToolbarPosition } from "../ui/types";
1919

2020
export type FeatureItem = {
2121
key: string;
2222
localOverride: boolean | null;
2323
isEnabled: boolean;
2424
};
25-
export interface ToolbarPosition {
26-
placement: DialogPlacement;
27-
offset?: Offset;
28-
}
2925

3026
type Feature = {
3127
key: string;

packages/browser-sdk/src/toolbar/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { BucketClient } from "../client";
44
import { toolbarContainerId } from "../ui/constants";
55
import { attachContainer } from "../ui/utils";
66

7-
import Toolbar, { ToolbarPosition } from "./Toolbar";
7+
import Toolbar from "./Toolbar";
8+
import { ToolbarPosition } from "../ui/types";
89

910
type showToolbarToggleOptions = {
1011
bucketClient: BucketClient;

packages/browser-sdk/src/ui/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ export type Position =
3131
anchor: HTMLElement | null;
3232
placement?: PopoverPlacement;
3333
};
34+
35+
export interface ToolbarPosition {
36+
placement: DialogPlacement;
37+
offset?: Offset;
38+
}

packages/node-sdk/src/client.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,7 @@ export class BucketClient {
413413
/**
414414
* Tracks an event in Bucket.
415415
416-
* @param event - The event to track.
417-
* @param userId - The userId of the user who performed the event
418-
* @param opts - The options.
419-
* @param opts.attributes - The attributes of the event (optional).
420-
* @param opts.meta - The meta context associated with tracking (optional).
421-
* @param opts.companyId - Optional company ID for the event (optional).
416+
* @param options.companyId - Optional company ID for the event (optional).
422417
*
423418
* @throws An error if the user is not set or the event is invalid or the options are invalid.
424419
* @remarks
@@ -1228,7 +1223,6 @@ export class BoundBucketClient {
12281223
* @param client - The `BucketClient` to use.
12291224
* @param options - The options for the client.
12301225
* @param options.enableTracking - Whether to enable tracking for the client.
1231-
* @param options.context - The context for the client.
12321226
*
12331227
* @internal
12341228
*/

packages/node-sdk/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@ export type {
55
ClientOptions,
66
Context,
77
ContextWithTracking,
8+
EmptyFeatureRemoteConfig,
89
Feature,
10+
FeatureOverride,
911
FeatureOverrides,
1012
FeatureOverridesFn,
13+
FeatureRemoteConfig,
1114
Features,
15+
FullFeatureOverride,
1216
HttpClient,
1317
HttpClientResponse,
1418
IdType,
1519
LOG_LEVELS,
1620
Logger,
1721
LogLevel,
1822
RawFeature,
23+
RawFeatureRemoteConfig,
1924
TrackingMeta,
2025
TrackOptions,
2126
TypedFeatures,
27+
TypedFeatureKey,
2228
} from "./types";

0 commit comments

Comments
 (0)