Skip to content

Commit 67d8c29

Browse files
Merge pull request #171 from splitio/export_missing_types
Add missing type exports
2 parents 6e3738f + 1f370c2 commit 67d8c29

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This SDK is designed to work with Split, the platform for controlled rollouts, w
1111

1212
This SDK is compatible with React 16.3.0 and above, since it uses [React Context API](https://reactjs.org/docs/context.html).
1313

14-
Some features, such as `useClient` and `useManager`, use [React Hooks API](https://reactjs.org/docs/hooks-overview.html) that requires React 16.8.0 or later.
14+
Some features, such as `useSplitClient` and `useSplitTreatments`, use [React Hooks API](https://reactjs.org/docs/hooks-overview.html) that requires React 16.8.0 or later.
1515

1616
## Getting started
1717
Below is a simple example that describes the instantiation and most basic usage of our SDK:

src/__tests__/index.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
useSplitTreatments as exportedUseSplitTreatments,
1717
useSplitManager as exportedUseSplitManager,
1818
// Checks that types are exported. Otherwise, the test would fail with a TS error.
19+
GetTreatmentsOptions,
1920
ISplitClientChildProps,
2021
ISplitClientProps,
2122
ISplitContextValues,
@@ -24,7 +25,9 @@ import {
2425
ISplitStatus,
2526
ISplitTreatmentsChildProps,
2627
ISplitTreatmentsProps,
27-
IUpdateProps
28+
IUpdateProps,
29+
IUseSplitClientOptions,
30+
IUseSplitTreatmentsOptions,
2831
} from '../index';
2932
import { SplitContext } from '../SplitContext';
3033
import { SplitFactory as SplitioEntrypoint } from '@splitsoftware/splitio/client';

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export { SplitContext } from './SplitContext';
2525

2626
// Types
2727
export type {
28+
GetTreatmentsOptions,
2829
ISplitClientChildProps,
2930
ISplitClientProps,
3031
ISplitContextValues,
@@ -33,5 +34,7 @@ export type {
3334
ISplitStatus,
3435
ISplitTreatmentsChildProps,
3536
ISplitTreatmentsProps,
36-
IUpdateProps
37+
IUpdateProps,
38+
IUseSplitClientOptions,
39+
IUseSplitTreatmentsOptions,
3740
} from './types';

src/types.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ export type GetTreatmentsOptions = ({
193193
}
194194

195195
/**
196-
* useSplitTreatments options interface. This is the options object accepted by useSplitTreatments hook,
197-
* used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()', and retrieve the result together with the Split context.
196+
* useSplitTreatments options interface. This is the options object accepted by useSplitTreatments hook, used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()',
197+
* depending on whether `names` or `flagSets` options are provided, and to retrieve the result along with the Split context.
198198
*/
199199
export type IUseSplitTreatmentsOptions = GetTreatmentsOptions & IUseSplitClientOptions;
200200

@@ -206,17 +206,20 @@ export interface ISplitTreatmentsChildProps extends ISplitContextValues {
206206
/**
207207
* An object with the treatments with configs for a bulk of feature flags, returned by client.getTreatmentsWithConfig().
208208
* Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example:
209+
*
210+
* ```js
209211
* {
210-
* feature1: { treatment: 'on', config: null }
212+
* feature1: { treatment: 'on', config: null },
211213
* feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
212214
* }
215+
* ```
213216
*/
214217
treatments: SplitIO.TreatmentsWithConfig;
215218
}
216219

217220
/**
218-
* SplitTreatments Props interface. These are the props accepted by SplitTreatments component,
219-
* used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()', and pass the result to the child component.
221+
* SplitTreatments Props interface. These are the props accepted by SplitTreatments component, used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()',
222+
* depending on whether `names` or `flagSets` props are provided, and to pass the result to the child component.
220223
*/
221224
export type ISplitTreatmentsProps = GetTreatmentsOptions & {
222225

0 commit comments

Comments
 (0)