-
Notifications
You must be signed in to change notification settings - Fork 83
feat: Convert optimizely_config module to TS #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
public revision: string; | ||
private datafile: string; | ||
|
||
constructor(configObj: OptimizelyConfigOptions, datafile: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the type of configObj
should be ProjectConfig
from the project_config module (link). Using this might also remove the need to create some of the interfaces above.
featureKeyMap: { [key: string]: FeatureFlag }; | ||
} | ||
|
||
interface ExperimentIds { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love the name ExperimentIds
for this. It is a mapping from experiment ID to boolean. Since it's only used in one place I'm not sure it needs to be declared as an interface.
* @param {Rollout[]} rollouts | ||
* @returns {ExperimentIds} Experiment Ids which are part of rollout | ||
*/ | ||
private getRolloutExperimentIds(rollouts: Rollout[]): ExperimentIds { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For getRolloutExperimentIds
, getExperimentsMap
, getMergedVariablesMap
, and getFeaturesMap
, I don't think they need to be class methods. They don't access any data from this
, they just use arguments. I suggest leaving them as separate (unexported) functions in this module, or making them static methods.
Summary
optimizely_config
module to TSTest plan
Existing unit and fsc tests and running local bundle
Issues