From e14cbc6c6f2deb5d356e5b91a98c793e012f990a Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Mon, 4 Oct 2021 22:11:12 +0200 Subject: [PATCH] react-switch: Adjust signature to use ForwardRefComponent (#20093) * Adds ForwardRefComponent to react-switch components declaration * Change files --- ...-react-switch-c2b06fdf-4a4b-4510-909a-0554b6039369.json | 7 +++++++ packages/react-switch/etc/react-switch.api.md | 3 ++- packages/react-switch/src/components/Switch/Switch.tsx | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 change/@fluentui-react-switch-c2b06fdf-4a4b-4510-909a-0554b6039369.json diff --git a/change/@fluentui-react-switch-c2b06fdf-4a4b-4510-909a-0554b6039369.json b/change/@fluentui-react-switch-c2b06fdf-4a4b-4510-909a-0554b6039369.json new file mode 100644 index 0000000000000..905b07bd97db1 --- /dev/null +++ b/change/@fluentui-react-switch-c2b06fdf-4a4b-4510-909a-0554b6039369.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Adds ForwardRefComponent to react-switch components declaration", + "packageName": "@fluentui/react-switch", + "email": "bsunderhus@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-switch/etc/react-switch.api.md b/packages/react-switch/etc/react-switch.api.md index 145623de71f90..3edfff298c344 100644 --- a/packages/react-switch/etc/react-switch.api.md +++ b/packages/react-switch/etc/react-switch.api.md @@ -6,6 +6,7 @@ import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; +import type { ForwardRefComponent } from '@fluentui/react-utilities'; import type { IntrinsicShorthandProps } from '@fluentui/react-utilities'; import * as React_2 from 'react'; @@ -13,7 +14,7 @@ import * as React_2 from 'react'; export const renderSwitch: (state: SwitchState) => JSX.Element; // @public -export const Switch: React_2.ForwardRefExoticComponent>; +export const Switch: ForwardRefComponent; // @public (undocumented) export interface SwitchCommons { diff --git a/packages/react-switch/src/components/Switch/Switch.tsx b/packages/react-switch/src/components/Switch/Switch.tsx index 58df276eeee6d..69403ec1201d8 100644 --- a/packages/react-switch/src/components/Switch/Switch.tsx +++ b/packages/react-switch/src/components/Switch/Switch.tsx @@ -3,11 +3,12 @@ import { useSwitch } from './useSwitch'; import { renderSwitch } from './renderSwitch'; import { useSwitchStyles } from './useSwitchStyles'; import type { SwitchProps } from './Switch.types'; +import type { ForwardRefComponent } from '@fluentui/react-utilities'; /** * The Switch control enables users to trigger an option on or off through pressing on the component. */ -export const Switch = React.forwardRef((props, ref) => { +export const Switch: ForwardRefComponent = React.forwardRef((props, ref) => { const state = useSwitch(props, ref); useSwitchStyles(state);