Angular feature flags library with strong typing support.
npm install ngx-ffAngular feature flags library with strong typing support.
To enable strong typing for your feature flag keys, extend the Keys type via module augmentation. This will provide autocomplete and type checking when using the *featureFlags directive.
Create a type definition file in your app (e.g., feature-flags.types.ts):
``typescript`
declare module 'ngx-ff' {
namespace FeatureFlagKeys {
type Keys = 'feature-a' | 'feature-b' | 'feature-c';
}
}
After extending the Keys type, you'll get full type safety:
`typescript
// ✅ Valid - TypeScript will autocomplete and type-checkContent for feature AContent for feature B
// ❌ Invalid - TypeScript will show an error
Running unit tests
Run
nx test ngx-ff` to execute the unit tests.