Skip to content

feat: Convert projectConfig module to TS #653

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

Merged
merged 9 commits into from
Apr 23, 2021

Conversation

yavorona
Copy link
Contributor

Summary

Convert projectConfig module to TS

Test plan

Existing unit tests

@yavorona yavorona added the WIP label Feb 23, 2021
@yavorona yavorona self-assigned this Feb 23, 2021
@yavorona yavorona requested a review from a team as a code owner February 23, 2021 23:47
@yavorona yavorona force-pushed the pnguen/convert-project-config-to-ts branch from e10eda9 to 8acab1c Compare March 17, 2021 23:06
@coveralls
Copy link

coveralls commented Mar 19, 2021

Coverage Status

Coverage increased (+0.0003%) to 96.957% when pulling f9a5442 on pnguen/convert-project-config-to-ts into 2387061 on master.

@zashraf1985
Copy link
Contributor

I reviewed #659 first and i see that you have already converted projectConfig module there. what is the reason to do it in two places?

@yavorona
Copy link
Contributor Author

yavorona commented Apr 19, 2021

@zashraf1985 the #659 branch is based off of this branch. The plan was for this pr to be merged first and #659 to be rebased after that. Should have been more explicit about it, sorry!

Copy link
Contributor

@zashraf1985 zashraf1985 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Great! A few nits and optional suggestions.

* Determine for given experiment if event is running, which determines whether should be dispatched or not
* @param {ProjectConfig} configObj Object representing project configuration
* @param {string} experimentKey Experiment key for which the status is to be determined
* @return {boolean} True is the experiment is running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUPER NIT: True if

* @param {ProjectConfig} configObj Object representing project configuration
* @param {string} experimentKey Experiment key for which the status is to be determined
* @return {boolean} True is the experiment is running
* False is the experiment is not running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUPER NIT: False if

variableValue: string,
variableType: string,
logger: LogHandler
): unknown {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should return type be one of the variable types or'ed? like string | number | .... Just suggesting. this is also fine as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been using unknown everywhere when dealing with variables of unknown type (example functions: getFeatureVariableForType, getFeatureVariableValueFromVariation , and getAllFeatureVariables, so I think it is best to stay consistent with what we have.

* @returns {TryCreatingProjectConfigResult}
*/
export const tryCreatingProjectConfig = function(
config: TryCreatingProjectConfigConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why defining this interface separately. if its not being reused anywhere or not being exposed outside, this can probably be done inline.? same for the return type. Just a suggestion, feel free to take it or leave it.

@yavorona yavorona merged commit 29aed56 into master Apr 23, 2021
@yavorona yavorona deleted the pnguen/convert-project-config-to-ts branch April 23, 2021 21:44
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