ngx-ff
v0.1.14
Published
Angular feature flags library with strong typing support.
Readme
ngx-ff
Angular feature flags library with strong typing support.
Strongly Typed Feature Flag Keys
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.
Setup
Create a type definition file in your app (e.g., feature-flags.types.ts):
declare module 'ngx-ff' {
namespace FeatureFlagKeys {
type Keys = 'feature-a' | 'feature-b' | 'feature-c';
}
}Usage
After extending the Keys type, you'll get full type safety:
// ✅ Valid - TypeScript will autocomplete and type-check
<div *featureFlags="'feature-a'">Content for feature A</div>
<div *featureFlags="'feature-b'">Content for feature B</div>
// ❌ Invalid - TypeScript will show an error
<div *featureFlags="'invalid-key'">This will cause a type error</div>Running unit tests
Run nx test ngx-ff to execute the unit tests.
