-
Notifications
You must be signed in to change notification settings - Fork 83
feat: Create index.d.ts file for decision_service #568
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
| @@ -0,0 +1,151 @@ | |||
| /** | |||
| * Copyright 2018-2020, Optimizely | |||
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.
Should just be 2020
| } | ||
|
|
||
| export interface ConfigObj { | ||
| __datafileStr: 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.
Shouldn't document private properties
| featureKeyMap: {[key: string]: FeatureFlag}; //look into this one closer | ||
| } | ||
|
|
||
| interface Event { |
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.
A lot of these entities are being defined in #567 already. We should reuse them.
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.
Agree, for all the entity types that are related to or located in project config.
mjc1283
left a comment
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.
Requesting changes to locate type definitions in the appropriate module and import them into the consumers.
| UNSTABLE_conditionEvaluators: unknown; | ||
| } | ||
|
|
||
| interface ConfigObj { |
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.
This should be imported from the project config module (see PR #567)
|
|
||
| export function createDecisionService(options: Options): DecisionService; | ||
|
|
||
| export interface UserProfileService { |
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.
Are UserProfileService and/or UserProfile needed in any other modules? There might be a more natural place for these to live.
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 moved them back per your comment on UserProfileService. Although, now we are importing them from a root-level module to here, which is an anti-pattern. What are your thoughts @mjc1283?
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.
We are importing them from a root-level module to here, which is an anti-pattern.
Agreed. Let's keep them in decision service like you originally had, and consider moving them later on if it makes sense.
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.
Sounds good. UserAttributes would also need to be moved here for now to avoid anti-pattern.
| featureKeyMap: {[key: string]: FeatureFlag}; //look into this one closer | ||
| } | ||
|
|
||
| interface Event { |
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.
Agree, for all the entity types that are related to or located in project config.
| value: string | number | boolean | null; | ||
| } | ||
|
|
||
| type ConditionTree<Leaf> = Leaf | unknown[]; |
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.
Should be imported from condition_tree_evaluator
mjc1283
left a comment
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.
|
|
||
| export function createDecisionService(options: Options): DecisionService; | ||
|
|
||
| export interface UserProfileService { |
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.
We are importing them from a root-level module to here, which is an anti-pattern.
Agreed. Let's keep them in decision service like you originally had, and consider moving them later on if it makes sense.
| }> | ||
| } | ||
|
|
||
| type ConditionTree<Leaf> = Leaf | unknown[]; |
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.
Import from condition_tree_evaluator
mjc1283
left a comment
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.
Still waiting for update after #567 is complete
21d7df7 to
2b495c5
Compare
| interface Decision { | ||
| experiment: import('../../shared_types').Experiment | null; | ||
| variation: import('../../shared_types').Variation | null; | ||
| decisionSource: 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.
We might want to use an enum for this. Can be updated later if so.
Summary
Create
index.d.tsfile for decision_service module