Skip to content

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

Merged
merged 2 commits into from
Jun 27, 2025

Conversation

AnastasiiaSvietlova
Copy link
Contributor

Goal

Convert @bugsnag/core/src/lib/feature-flag-delegate to TypeScript

Testing

Covered by existing end to end and unit tests

@AnastasiiaSvietlova AnastasiiaSvietlova marked this pull request as ready for review June 12, 2025 08:50
}
return result;
});
},
Copy link
Contributor Author

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.

@gingerbenw gingerbenw force-pushed the PLAT-13690-feature-flag-delegate branch from fd583de to 911e9c3 Compare June 24, 2025 09:43
Copy link

github-actions bot commented Jun 24, 2025

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 81.41 kB 18.60 kB
After 81.38 kB 18.55 kB
± -32 bytes -45 bytes

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against c0bbe17

@gingerbenw gingerbenw force-pushed the PLAT-13690-feature-flag-delegate branch from 911e9c3 to d6acfbc Compare June 24, 2025 13:49
Comment on lines 11 to 18
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
Copy link
Member

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 };
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const result: { featureFlag: string; variant?: string } = { featureFlag: flag.name };
const result: FeatureFlagEventApi = { featureFlag: flag.name };

@AnastasiiaSvietlova AnastasiiaSvietlova force-pushed the PLAT-13690-feature-flag-delegate branch from 56aacd2 to c0bbe17 Compare June 26, 2025 14:51
@gingerbenw gingerbenw merged commit ed70302 into integration/typescript Jun 27, 2025
48 checks passed
@gingerbenw gingerbenw deleted the PLAT-13690-feature-flag-delegate branch June 27, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants