diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index 029b0faff8..9b68d2a10d 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -238,9 +238,13 @@ export type ErrorBoundaryFallbackProps = { export const FeatureFlagged: (props: FeatureFlaggedProps) => JSX.Element | null; // @public (undocumented) -export type FeatureFlaggedProps = FeatureFlaggedSelector & { +export type FeatureFlaggedProps = { children: JSX.Element | null; -}; +} & ({ + with: string; +} | { + without: string; +}); // @public (undocumented) export const FlatRoutes: (props: FlatRoutesProps) => JSX.Element | null; diff --git a/packages/core-app-api/src/index.test.ts b/packages/core-app-api/src/index.test.ts index bec176fda8..654c547fca 100644 --- a/packages/core-app-api/src/index.test.ts +++ b/packages/core-app-api/src/index.test.ts @@ -37,6 +37,7 @@ describe('index', () => { ConfigReader: expect.any(Function), ErrorAlerter: expect.any(Function), ErrorApiForwarder: expect.any(Function), + FeatureFlagged: expect.any(Function), GithubAuth: expect.any(Function), GitlabAuth: expect.any(Function), GoogleAuth: expect.any(Function), diff --git a/packages/core-app-api/src/routing/FeatureFlagged.tsx b/packages/core-app-api/src/routing/FeatureFlagged.tsx index 5b20d9aaac..809eb7c69c 100644 --- a/packages/core-app-api/src/routing/FeatureFlagged.tsx +++ b/packages/core-app-api/src/routing/FeatureFlagged.tsx @@ -20,19 +20,10 @@ import { attachComponentData, } from '@backstage/core-plugin-api'; -export type FeatureFlaggedWith = { - with: string; -}; - -export type FeatureFlaggedWithout = { - without: string; -}; - -export type FeatureFlaggedSelector = FeatureFlaggedWith | FeatureFlaggedWithout; -export type FeatureFlaggedProps = FeatureFlaggedSelector & { - children: JSX.Element | null; -}; - +export type FeatureFlaggedProps = { children: JSX.Element | null } & ( + | { with: string } + | { without: string } +); export const FeatureFlagged = (props: FeatureFlaggedProps) => { const { children } = props; const featureFlagApi = useApi(featureFlagsApiRef);