-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Convert config service to be strict compliant #8561
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8561 +/- ##
=======================================
Coverage 27.14% 27.14%
=======================================
Files 2329 2329
Lines 67926 67926
Branches 12689 12689
=======================================
Hits 18438 18438
Misses 48095 48095
Partials 1393 1393 ☔ View full report in Codecov by Sentry. |
This comment was marked as off-topic.
This comment was marked as off-topic.
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.
Overall, the better way to achieve strict-null in state providers is to redefine key definitions such that the return state is always | undefined
rather than forcing implementers to specify it.
abstract getFeatureFlag$<T extends boolean | number | string>( | ||
key: FeatureFlag, | ||
defaultValue?: T, | ||
) => Observable<T>; | ||
): Observable<T | undefined>; |
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.
It would be better to remove the optionality on defaultValue
and force a real return.
Same with async impl
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 can default it to false. I tried to avoid changing the actual behaviour.
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.
It would be better to default based on the incoming type.
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 disagree with this change though. I think we should postpone making this change until we refactor the feature flags to be able to enforce type checking. That will also allow us to provide a reasonable default value like false, 0, "".
Type of change
Objective
Explore how much effort it is to convert services to be strict compliant. I believe the config service should preserve the existing behaviour.
The changes are primarily to:
undefined
or?
to non required properties/return values.null
withundefined
. (Not strictly required but it makes the handling easier.abstract
keywords to abstract service.Before you submit