File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
packages/optimizely-sdk/lib Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ import {
35
35
FeatureVariable ,
36
36
Variation ,
37
37
OptimizelyVariation ,
38
- VariationVariable ,
38
+ VariableType ,
39
+ VariationVariable
39
40
} from '../../shared_types' ;
40
41
41
42
interface TryCreatingProjectConfigConfig {
@@ -203,7 +204,7 @@ export const createProjectConfig = function(
203
204
// Converting it to a first-class json type while creating Project Config
204
205
feature . variables . forEach ( ( variable ) => {
205
206
if ( variable . type === FEATURE_VARIABLE_TYPES . STRING && variable . subType === FEATURE_VARIABLE_TYPES . JSON ) {
206
- variable . type = FEATURE_VARIABLE_TYPES . JSON ;
207
+ variable . type = FEATURE_VARIABLE_TYPES . JSON as VariableType ;
207
208
delete variable . subType ;
208
209
}
209
210
} ) ;
@@ -584,7 +585,7 @@ export const getVariableValueForVariation = function(
584
585
*/
585
586
export const getTypeCastValue = function (
586
587
variableValue : string ,
587
- variableType : string ,
588
+ variableType : VariableType ,
588
589
logger : LogHandler
589
590
) : unknown {
590
591
let castValue ;
Original file line number Diff line number Diff line change @@ -129,8 +129,16 @@ export interface Experiment {
129
129
forcedVariations ?: { [ key : string ] : string } ;
130
130
}
131
131
132
+ export enum VariableType {
133
+ BOOLEAN = 'boolean' ,
134
+ DOUBLE = 'double' ,
135
+ INTEGER = 'integer' ,
136
+ STRING = 'string' ,
137
+ JSON = 'json' ,
138
+ }
139
+
132
140
export interface FeatureVariable {
133
- type : string ;
141
+ type : VariableType ;
134
142
key : string ;
135
143
id : string ;
136
144
defaultValue : string ;
You can’t perform that action at this time.
0 commit comments