Skip to content

Conversation

yavorona
Copy link
Contributor

@yavorona yavorona commented Nov 18, 2020

Summary

  • Convert optimizely_config module to TS

Test plan

Existing unit and fsc tests and running local bundle

Issues

@yavorona yavorona requested a review from a team as a code owner November 18, 2020 00:56
@yavorona yavorona self-assigned this Nov 18, 2020
@coveralls
Copy link

coveralls commented Nov 18, 2020

Coverage Status

Coverage increased (+0.002%) to 96.712% when pulling e4d8c6e on pnguen/optimizely-config-to-ts into 1c25d23 on master.

public revision: string;
private datafile: string;

constructor(configObj: OptimizelyConfigOptions, datafile: string) {
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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.

@yavorona yavorona merged commit dfc1b7f into master Nov 30, 2020
@yavorona yavorona deleted the pnguen/optimizely-config-to-ts branch November 30, 2020 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants