Skip to content

Commit 0ff9901

Browse files
Fixed some types
1 parent 49d76b2 commit 0ff9901

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

types/splitio.d.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ interface IBasicSDK {
268268
}
269269
/****** Exposed namespace ******/
270270
/**
271-
* Shared types and interfaces for `@splitsoftware` packages for usage when integrating JavaScript SDKs with TypeScript.
271+
* Shared types and interfaces for `@splitsoftware` packages, to support integrating JavaScript SDKs with TypeScript.
272272
*/
273273
declare namespace SplitIO {
274274
/**
@@ -380,25 +380,30 @@ declare namespace SplitIO {
380380
type MockedFeaturesMap = {
381381
[featureName: string]: string | TreatmentWithConfig;
382382
};
383+
/**
384+
* Impression DTO generated by the SDK when processing evaluations.
385+
* @typedef {Object} ImpressionDTO
386+
*/
387+
type ImpressionDTO = {
388+
feature: string;
389+
keyName: string;
390+
treatment: string;
391+
time: number;
392+
bucketingKey?: string;
393+
label: string;
394+
changeNumber: number;
395+
pt?: number;
396+
}
383397
/**
384398
* Object with information about an impression. It contains the generated impression DTO as well as
385399
* complementary information around where and how it was generated in that way.
386400
* @typedef {Object} ImpressionData
387401
*/
388402
type ImpressionData = {
389-
impression: {
390-
feature: string;
391-
keyName: string;
392-
treatment: string;
393-
time: number;
394-
bucketingKey?: string;
395-
label: string;
396-
changeNumber: number;
397-
pt?: number;
398-
};
403+
impression: ImpressionDTO;
399404
attributes?: SplitIO.Attributes;
400-
ip: string;
401-
hostname: string;
405+
ip: string | false;
406+
hostname: string | false;
402407
sdkLanguageVersion: string;
403408
};
404409
/**
@@ -451,10 +456,10 @@ declare namespace SplitIO {
451456
defaultTreatment: string;
452457
};
453458
/**
454-
* A promise that resolves to a feature flag view.
455-
* @typedef {Promise<SplitView>} SplitView
459+
* A promise that resolves to a feature flag view or null if the feature flag is not found.
460+
* @typedef {Promise<SplitView | null>} SplitViewAsync
456461
*/
457-
type SplitViewAsync = Promise<SplitView>;
462+
type SplitViewAsync = Promise<SplitView | null>;
458463
/**
459464
* An array containing the SplitIO.SplitView elements.
460465
*/
@@ -478,15 +483,14 @@ declare namespace SplitIO {
478483
* Storage for synchronous (standalone) SDK.
479484
* Its interface details are not part of the public API.
480485
*/
481-
type StorageSync = {};
486+
type StorageSync = any;
482487
/**
483488
* Storage builder for synchronous (standalone) SDK.
484-
* By returning undefined, the SDK will use the default IN MEMORY storage.
485489
* Input parameter details are not part of the public API.
486490
*/
487491
type StorageSyncFactory = {
488492
readonly type: StorageType;
489-
(params: {}): (StorageSync | undefined);
493+
(params: any): (StorageSync | undefined);
490494
}
491495
/**
492496
* Configuration params for `InLocalStorage`
@@ -503,14 +507,14 @@ declare namespace SplitIO {
503507
* Storage for asynchronous (consumer) SDK.
504508
* Its interface details are not part of the public API.
505509
*/
506-
type StorageAsync = {}
510+
type StorageAsync = any
507511
/**
508512
* Storage builder for asynchronous (consumer) SDK.
509513
* Input parameter details are not part of the public API.
510514
*/
511515
type StorageAsyncFactory = {
512-
readonly type: 'PLUGGABLE';
513-
(params: {}): StorageAsync;
516+
readonly type: StorageType;
517+
(params: any): StorageAsync;
514518
}
515519
/**
516520
* Configuration params for `PluggableStorage`
@@ -564,15 +568,15 @@ declare namespace SplitIO {
564568
* SDK integration instance.
565569
* Its interface details are not part of the public API.
566570
*/
567-
type Integration = {};
571+
type Integration = any;
568572
/**
569573
* SDK integration factory.
570574
* By returning an integration, the SDK will queue events and impressions into it.
571575
* Input parameter details are not part of the public API.
572576
*/
573577
type IntegrationFactory = {
574578
readonly type: string;
575-
(params: {}): (Integration | void);
579+
(params: any): (Integration | void);
576580
}
577581
/**
578582
* A pair of user key and it's trafficType, required for tracking valid Split events.
@@ -594,7 +598,7 @@ declare namespace SplitIO {
594598
properties?: Properties;
595599
trafficTypeName?: string;
596600
key?: string;
597-
timestamp?: number;
601+
timestamp: number;
598602
};
599603
/**
600604
* Object representing the data sent by Split (events and impressions).

0 commit comments

Comments
 (0)