Skip to content

Commit eb51c4b

Browse files
author
Yury Kornilov
committed
fix typings
1 parent 0bc08f7 commit eb51c4b

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/ui/components/DashKit/plugins/Widget/WidgetPlugin.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const widgetPlugin: PluginWidget = {
3434
},
3535
renderer: function Wrapper(
3636
props: Props,
37-
forwardedRef: React.RefObject<ChartWidgetWithWrapRefProps>,
37+
forwardedRef?: React.RefCallback<ChartWidgetWithWrapRefProps>,
3838
) {
3939
const rootNodeRef = React.useRef<HTMLDivElement>(null);
4040
const {onWidgetLoadData} = useWidgetContext({

src/ui/components/DashKit/plugins/Widget/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export type WidgetPluginData = ConfigItem['data'];
3535
export type WidgetPluginDataWithTabs = ConfigItemWithTabs['data'] & {tabs: Array<CurrentTab>};
3636

3737
export type WidgetPluginProps = Omit<PluginWidgetProps, 'data'> & {
38-
forwardedRef: React.RefObject<ChartKit | ChartKitRef>;
38+
forwardedRef?:
39+
| React.RefObject<ChartKit | ChartKitRef>
40+
| React.RefCallback<ChartKit | ChartKitRef>;
3941
data: WidgetPluginDataWithTabs | WidgetPluginData;
4042
getMarkdown?: (props: {text: string}) => Promise<{result: string; meta?: object}>;
4143
debouncedAdjustWidgetLayout: DebouncedFunc<(props: AdjustWidgetLayoutProps) => void>;

src/ui/components/Widgets/Chart/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ export type ChartWithProviderProps = ChartsProps & {
191191
dataProvider: ChartKitDataProvider;
192192
};
193193

194-
type ChartRefProp = {forwardedRef: React.RefObject<ChartKit | ChartKitRef>};
194+
type ChartRefProp = {
195+
forwardedRef?:
196+
| React.RefObject<ChartKit | ChartKitRef>
197+
| React.RefCallback<ChartKit | ChartKitRef>;
198+
};
195199

196200
export type ChartWrapperWithRefProps =
197201
| ChartWidgetProviderPropsWithRefProps

src/ui/libs/DatalensChartkit/components/ChartKitBase/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ export type ChartKitBaseWrapperProps = ChartsProps & {
8787
};
8888

8989
export type ChartKitBaseWrapperWithRefProps = ChartKitBaseWrapperProps & {
90-
forwardedRef:
90+
forwardedRef?:
9191
| React.RefObject<ChartKit | ChartKitRef>
92-
| React.MutableRefObject<ChartKit | ChartKitRef | null>;
92+
| React.MutableRefObject<ChartKit | ChartKitRef | null>
93+
| React.RefCallback<ChartKit | ChartKitRef>;
9394
};
9495

9596
export interface ChartKitWrapperState {

0 commit comments

Comments
 (0)