Skip to content

Commit 8f82e6f

Browse files
committed
🏷️ fix flow type definition
Signed-off-by: w01gang <[email protected]>
1 parent 0bc9823 commit 8f82e6f

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/index.js.flow

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ type FeatureName = string;
33

44
type FeatureVariant = string;
55

6-
type ComponentName = string;
7-
86
export type Rules = {|
9-
featureFlags : { [key: ComponentName]: FeatureName, ... },
10-
features: { [key: FeatureName]: FeatureVariant, ... },
11-
validator ?: (params: Rules & { name: string }) => boolean,
7+
featureFlags: { [key: FeatureName]: FeatureVariant, ... },
8+
features: { [key: FeatureName]: FeatureVariant, ... },
9+
validator?: (params: Rules & { name: string }) => boolean,
1210
|};
1311

1412
declare type ProviderProps = {|
@@ -18,18 +16,18 @@ declare type ProviderProps = {|
1816

1917
declare type ConsumerProps = {|
2018
children: React$Node,
21-
fallback ?: React$Node,
22-
name: ComponentName,
19+
fallback?: React$Node,
20+
name: FeatureName,
2321
|};
2422

2523
declare type SwitchProps = {|
2624
children: React$Node,
27-
fallback: React$Node,
28-
name: ComponentName,
25+
fallback: React$Node,
26+
name: FeatureName,
2927
|};
3028

3129
declare export function FeatureGateProvider(props: ProviderProps): React$Node;
3230

33-
declare export function usePermission(name: ComponentName): {| ...Rules, granted: boolean |};
31+
declare export function useFeature(name: FeatureName): {| ...Rules, enabled: boolean |};
3432

3533
declare export function PermissionGate(props: ConsumerProps): React$Node;

0 commit comments

Comments
 (0)