Skip to content

Commit 9bc27b2

Browse files
committed
chore(v0): resolve issues with React 18 types
1 parent bdecec4 commit 9bc27b2

File tree

354 files changed

+547
-351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

354 files changed

+547
-351
lines changed

packages/fluentui/code-sandbox/src/SandboxApp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const themes = {
5555
teamsHighContrastTheme,
5656
};
5757

58-
export const SandboxApp: React.FunctionComponent = props => {
58+
export const SandboxApp: React.FunctionComponent<React.PropsWithChildren<unknown>> = props => {
5959
const { children } = props;
6060
const [theme, setTheme] = React.useState(items[0].value);
6161

packages/fluentui/docs-components/src/CodeSnippet/CodeSnippetLabel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const copyIcon = (
2222
</svg>
2323
);
2424

25-
export const CodeSnippetLabel: React.FunctionComponent<CopySnippetLabelProps> = props => {
25+
export const CodeSnippetLabel: React.FunctionComponent<React.PropsWithChildren<CopySnippetLabelProps>> = props => {
2626
const { copyable, label, mode, value } = props;
2727
const hasLabel = label !== false;
2828

packages/fluentui/docs-components/src/knobs/KnobProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type KnobProviderProps = {
1414
components?: Partial<KnobComponents>;
1515
};
1616

17-
export const KnobProvider: React.FunctionComponent<KnobProviderProps> = props => {
17+
export const KnobProvider: React.FunctionComponent<React.PropsWithChildren<KnobProviderProps>> = props => {
1818
const { children, components } = props;
1919

2020
const [knobs, setKnobs] = React.useState<KnobSet>({});

packages/fluentui/docs-components/src/knobs/LogInspector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type LogInspectorProps = {
66
silent?: boolean;
77
};
88

9-
export const LogInspector: React.FunctionComponent<LogInspectorProps> = props => {
9+
export const LogInspector: React.FunctionComponent<React.PropsWithChildren<LogInspectorProps>> = props => {
1010
const { components } = React.useContext(KnobContext);
1111

1212
const { clearLog } = React.useContext(LogContextFunctions);

packages/fluentui/docs-components/src/knobs/defaultComponents.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from './types';
99
import { parseValue } from './utils/parseRangeValue';
1010

11-
const KnobField: React.FunctionComponent<KnobComponentProps> = props => (
11+
const KnobField: React.FunctionComponent<React.PropsWithChildren<KnobComponentProps>> = props => (
1212
<div
1313
style={{
1414
borderBottom: '1px solid rgb(234, 234, 234)',
@@ -22,7 +22,7 @@ const KnobField: React.FunctionComponent<KnobComponentProps> = props => (
2222
</div>
2323
);
2424

25-
const KnobControl: React.FunctionComponent<KnobComponentProps> = props => (
25+
const KnobControl: React.FunctionComponent<React.PropsWithChildren<KnobComponentProps>> = props => (
2626
<span
2727
style={{
2828
verticalAlign: 'middle',
@@ -34,13 +34,13 @@ const KnobControl: React.FunctionComponent<KnobComponentProps> = props => (
3434
</span>
3535
);
3636

37-
const KnobLabel: React.FunctionComponent<KnobComponentProps> = props => (
37+
const KnobLabel: React.FunctionComponent<React.PropsWithChildren<KnobComponentProps>> = props => (
3838
<label htmlFor={`knob_${props.name}`} style={{ marginRight: 5 }}>
3939
{props.content || <code>{props.name}</code>}
4040
</label>
4141
);
4242

43-
const KnobBoolean: React.FunctionComponent<KnobComponentProps> = props => (
43+
const KnobBoolean: React.FunctionComponent<React.PropsWithChildren<KnobComponentProps>> = props => (
4444
<input
4545
id={`knob_${props.name}`}
4646
checked={props.value}
@@ -52,7 +52,7 @@ const KnobBoolean: React.FunctionComponent<KnobComponentProps> = props => (
5252
/>
5353
);
5454

55-
const KnobNumber: React.FunctionComponent<KnobNumberKnobComponentProps> = props => (
55+
const KnobNumber: React.FunctionComponent<React.PropsWithChildren<KnobNumberKnobComponentProps>> = props => (
5656
<input
5757
id={`knob_${props.name}`}
5858
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
@@ -76,7 +76,7 @@ const KnobNumber: React.FunctionComponent<KnobNumberKnobComponentProps> = props
7676
/>
7777
);
7878

79-
const KnobSelect: React.FunctionComponent<KnobComponentProps> = props => (
79+
const KnobSelect: React.FunctionComponent<React.PropsWithChildren<KnobComponentProps>> = props => (
8080
<select
8181
id={`knob_${props.name}`}
8282
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
@@ -94,7 +94,7 @@ const KnobSelect: React.FunctionComponent<KnobComponentProps> = props => (
9494
</select>
9595
);
9696

97-
const KnobRange: React.FunctionComponent<KnobRangeKnobComponentProps> = props => (
97+
const KnobRange: React.FunctionComponent<React.PropsWithChildren<KnobRangeKnobComponentProps>> = props => (
9898
<input
9999
id={`knob_${props.name}`}
100100
type="range"
@@ -109,7 +109,7 @@ const KnobRange: React.FunctionComponent<KnobRangeKnobComponentProps> = props =>
109109
/>
110110
);
111111

112-
const KnobString: React.FunctionComponent<KnobComponentProps> = props => (
112+
const KnobString: React.FunctionComponent<React.PropsWithChildren<KnobComponentProps>> = props => (
113113
<input
114114
id={`knob_${props.name}`}
115115
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
@@ -120,7 +120,7 @@ const KnobString: React.FunctionComponent<KnobComponentProps> = props => (
120120
/>
121121
);
122122

123-
const LogInspector: React.FunctionComponent<LogInspectorProps> = props => (
123+
const LogInspector: React.FunctionComponent<React.PropsWithChildren<LogInspectorProps>> = props => (
124124
<>
125125
<div style={{ display: 'flex', padding: 5 }}>
126126
<div style={{ flexGrow: 1 }}>

packages/fluentui/docs-components/src/knobs/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type KnobName = string;
1313

1414
export type KnobSet = Record<KnobName, KnobDefinition>;
1515

16-
export type KnobComponent<P = KnobComponentProps> = React.FunctionComponent<P>;
16+
export type KnobComponent<P = KnobComponentProps> = React.FunctionComponent<React.PropsWithChildren<P>>;
1717

1818
export type KnobComponents = {
1919
KnobField: KnobComponent;
@@ -26,7 +26,7 @@ export type KnobComponents = {
2626
KnobSelect: KnobComponent;
2727
KnobString: KnobComponent;
2828

29-
LogInspector: React.FunctionComponent<LogInspectorProps>;
29+
LogInspector: React.FunctionComponent<React.PropsWithChildren<LogInspectorProps>>;
3030
};
3131

3232
export type KnobComponentProps = KnobDefinition & {

packages/fluentui/docs/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function useRendererFactory(): CreateRenderer {
5353
return rendererFactory;
5454
}
5555

56-
const App: React.FC = () => {
56+
const App: React.FC<React.PropsWithChildren<unknown>> = () => {
5757
const [themeName, setThemeName] = React.useState<ThemeName>(themeContextDefaults.themeName);
5858
// State also contains the updater function so it will
5959
// be passed down into the context provider

packages/fluentui/docs/src/components/ComponentBestPractices.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type ComponentBestPracticesProps = Extendable<{
1717
dontList?: React.ReactNode[];
1818
}>;
1919

20-
const ComponentBestPractices: React.FC<ComponentBestPracticesProps> = ({ doList, dontList }) => {
20+
const ComponentBestPractices: React.FC<React.PropsWithChildren<ComponentBestPracticesProps>> = ({ doList, dontList }) => {
2121
const updatedDoList: ShorthandCollection<ListItemProps> = [];
2222
const updatedDontList: ShorthandCollection<ListItemProps> = [];
2323

packages/fluentui/docs/src/components/ComponentDoc/BehaviorDescription.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const AccessibilityDescription = React.lazy(() => import('./InlineMarkdown'));
55

66
const item = '- ';
77

8-
const BehaviorDescription: React.FunctionComponent<{ value: string }> = ({ value }) => {
8+
const BehaviorDescription: React.FunctionComponent<React.PropsWithChildren<{ value: string }>> = ({ value }) => {
99
// doctrine has a bug where it ignores list item indicator (-) if it is in the beginning of the comment
1010
// because of that, add the list item indicators after parsing
1111
const markdown =

packages/fluentui/docs/src/components/ComponentDoc/ComponentBundleSizeExample/ComponentBundleSizeExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ComponentBundleSizeExampleProps {
1212
examplePath: string;
1313
}
1414

15-
const ComponentBundleSizeExample: React.FunctionComponent<ComponentBundleSizeExampleProps> = props => {
15+
const ComponentBundleSizeExample: React.FunctionComponent<React.PropsWithChildren<ComponentBundleSizeExampleProps>> = props => {
1616
const { title, description, examplePath } = props;
1717
// "components/Divider/Performance/Divider.bsize" -> dividerBSizeTsxJs
1818
const perfTestName = `${_.camelCase(_.last(examplePath.split('/')))}TsxJs`;

0 commit comments

Comments
 (0)