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 {
3535 FeatureVariable ,
3636 Variation ,
3737 OptimizelyVariation ,
38- VariationVariable ,
38+ VariableType ,
39+ VariationVariable
3940} from '../../shared_types' ;
4041
4142interface TryCreatingProjectConfigConfig {
@@ -203,7 +204,7 @@ export const createProjectConfig = function(
203204 // Converting it to a first-class json type while creating Project Config
204205 feature . variables . forEach ( ( variable ) => {
205206 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 ;
207208 delete variable . subType ;
208209 }
209210 } ) ;
@@ -584,7 +585,7 @@ export const getVariableValueForVariation = function(
584585 */
585586export const getTypeCastValue = function (
586587 variableValue : string ,
587- variableType : string ,
588+ variableType : VariableType ,
588589 logger : LogHandler
589590) : unknown {
590591 let castValue ;
Original file line number Diff line number Diff line change @@ -129,8 +129,16 @@ export interface Experiment {
129129 forcedVariations ?: { [ key : string ] : string } ;
130130}
131131
132+ export enum VariableType {
133+ BOOLEAN = 'boolean' ,
134+ DOUBLE = 'double' ,
135+ INTEGER = 'integer' ,
136+ STRING = 'string' ,
137+ JSON = 'json' ,
138+ }
139+
132140export interface FeatureVariable {
133- type : string ;
141+ type : VariableType ;
134142 key : string ;
135143 id : string ;
136144 defaultValue : string ;
You can’t perform that action at this time.
0 commit comments