Skip to content

Commit bcf1d5e

Browse files
committed
fix: fix issues with react 18 types and implicit children
1 parent 01682bf commit bcf1d5e

File tree

11 files changed

+17
-12
lines changed

11 files changed

+17
-12
lines changed

packages/react-components/react-accordion/library/src/components/AccordionHeader/useAccordionHeader.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { mockAccordionContextValue, mockAccordionItemContextValue } from '../../
99
describe('useAccordionHeader_unstable', () => {
1010
it('should return button props as disabled even when it is not disabled (forceDisabled)', () => {
1111
const ref = React.createRef<HTMLElement>();
12-
const wrapper: React.FC = ({ children }) => (
12+
const wrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
1313
<AccordionProvider
1414
value={mockAccordionContextValue({
1515
openItems: [1],

packages/react-components/react-accordion/library/src/components/AccordionPanel/AccordionPanel.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AccordionItemProvider } from '../../contexts/accordionItem';
66
import { mockAccordionItemContextValue } from '../../testing/mockContextValue';
77

88
describe('AccordionPanel', () => {
9-
const Wrapper: React.FC = props => (
9+
const Wrapper: React.FC<React.PropsWithChildren<unknown>> = props => (
1010
<AccordionItemProvider
1111
value={mockAccordionItemContextValue({
1212
open: true,

packages/react-components/react-context-selector/src/useContextSelector.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const TestComponent: React.FC<{ index: number; onUpdate?: () => void }> = props
1616
return <div className="test-component" data-active={active} />;
1717
};
1818

19-
const TestProvider: React.FC = props => {
19+
const TestProvider: React.FC<React.PropsWithChildren<unknown>> = props => {
2020
const [index, setIndex] = React.useState<number>(0);
2121

2222
return (

packages/react-components/react-context-selector/src/useHasParentContext.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const TestContext = createContext<number>(1);
88
describe('useHasParentContext', () => {
99
it('should return true if wrapped with context', () => {
1010
// Arrange
11-
const wrapper: React.FC = ({ children }) => <TestContext.Provider value={1}>{children}</TestContext.Provider>;
11+
const wrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
12+
<TestContext.Provider value={1}>{children}</TestContext.Provider>
13+
);
1214
const { result } = renderHook(() => useHasParentContext(TestContext), { wrapper });
1315

1416
// Assert

packages/react-components/react-storybook-addon/src/decorators/withFluentProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const withFluentProvider = (StoryFn: () => JSX.Element, context: FluentSt
4747
);
4848
};
4949

50-
const FluentExampleContainer: React.FC<{ theme: Theme }> = props => {
50+
const FluentExampleContainer: React.FC<{ theme: Theme; children: React.ReactNode }> = props => {
5151
const { theme } = props;
5252

5353
const backgroundColor = theme.colorNeutralBackground2;

packages/react-components/react-tabster/src/hooks/useFocusVisible.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const createDocumentMock = (): Document => {
2020
describe('useFocusVisible', () => {
2121
describe('targetWindow', () => {
2222
it('uses a window from context by default', () => {
23-
const Wrapper: React.FC<{ targetDocument: Document | undefined }> = props => (
23+
const Wrapper: React.FC<{ targetDocument: Document | undefined; children?: React.ReactNode }> = props => (
2424
<Provider_unstable value={{ dir: 'ltr', targetDocument: props.targetDocument }}>
2525
{props.children}
2626
</Provider_unstable>
@@ -49,7 +49,7 @@ describe('useFocusVisible', () => {
4949
const element = targetDocument.createElement('div');
5050

5151
const { result, rerender } = renderHook<
52-
{ targetDocument: Document | undefined },
52+
{ targetDocument: Document | undefined; children?: React.ReactNode },
5353
React.MutableRefObject<HTMLElement | null>
5454
>(props => useFocusVisible({ targetDocument: props.targetDocument }), {
5555
wrapper: props => (

packages/react-components/react-toast/library/src/components/AriaLive/AriaLive.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { AriaLiveProps } from './AriaLive.types';
77
/**
88
* A component that manages aria live announcements imperatively
99
*/
10-
export const AriaLive: React.FC<AriaLiveProps> = props => {
10+
export const AriaLive: React.FC<React.PropsWithChildren<AriaLiveProps>> = props => {
1111
const state = useAriaLive_unstable(props);
1212

1313
useAriaLiveStyles_unstable(state);

packages/react-components/react-utilities/src/hooks/useId.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ describe('useId', () => {
4141

4242
it('consumers prefix from a context', () => {
4343
const { result } = renderHook(() => useId(), {
44-
wrapper: ({ children }) => <IdPrefixProvider value="scope-">{children}</IdPrefixProvider>,
44+
wrapper: ({ children }: { children: React.ReactNode }) => (
45+
<IdPrefixProvider value="scope-">{children}</IdPrefixProvider>
46+
),
4547
});
4648

4749
expect(result.current).toMatch(/^scope-fui-/);

packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { render } from '@testing-library/react';
33
import { applyTriggerPropsToChildren } from './applyTriggerPropsToChildren';
44
import type { FluentTriggerComponent } from './types';
55

6-
export const TestTrigger: React.FC<{ id?: string }> & FluentTriggerComponent = props => <>{props.children}</>;
6+
export const TestTrigger: React.FC<{ id?: string; children: React.ReactNode | (() => React.JSX.Element) }> &
7+
FluentTriggerComponent = props => <>{props.children}</>;
78
TestTrigger.displayName = 'TestTrigger';
89
TestTrigger.isFluentTriggerComponent = true;
910

packages/react-components/recipes/src/recipes/media-object/code-snippets/MediaObject.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const MediaObject: React.VoidFunctionComponent<MediaObjectTypes> = ({
4040
);
4141
};
4242

43-
const Legend: React.FC<{ colorClassName: string }> = ({ children, colorClassName }) => {
43+
const Legend: React.FC<React.PropsWithChildren<{ colorClassName: string }>> = ({ children, colorClassName }) => {
4444
const skeletonStyles = useSkeletonStyles();
4545
return (
4646
<div className={skeletonStyles.legend}>

0 commit comments

Comments
 (0)