-
Notifications
You must be signed in to change notification settings - Fork 256
Convert @bugsnag/core/src/lib/feature-flag-delegate to TypeScript #2459
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
Convert @bugsnag/core/src/lib/feature-flag-delegate to TypeScript #2459
Conversation
} | ||
return result; | ||
}); | ||
}, |
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.
toEventApi
method was rewrite with assistance of Copilot.
fd583de
to
911e9c3
Compare
911e9c3
to
d6acfbc
Compare
add: (existingFeatures: Array<FeatureFlag | null>, existingFeatureKeys: { [key: string]: unknown }, name?: unknown, variant?: any ) => void | ||
merge: ( | ||
existingFeatures: Array<{ name: string; variant?: any } | null>, | ||
newFeatures: any, | ||
existingFeatureKeys: { [key: string]: any } | ||
) => Array<{ name: string; variant: any }> | undefined | ||
toEventApi: (featureFlags: Array<FeatureFlag | null>) => FeatureFlagEventApi[] | ||
clear: (features: any, featuresIndex: any, name: any) => void |
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.
there's a lot of any
going on here - is it possible to figure out some more of these types? i.e. the third parameter of clear
, name
is probably a string?
return (featureFlags || []) | ||
.filter((flag): flag is FeatureFlag => flag !== null && typeof flag === 'object') | ||
.map((flag) => { | ||
const result: { featureFlag: string; variant?: string } = { featureFlag: flag.name }; |
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.
const result: { featureFlag: string; variant?: string } = { featureFlag: flag.name }; | |
const result: FeatureFlagEventApi = { featureFlag: flag.name }; |
56aacd2
to
c0bbe17
Compare
Goal
Convert @bugsnag/core/src/lib/feature-flag-delegate to TypeScript
Testing
Covered by existing end to end and unit tests