Skip to content

Commit

Permalink
chore: useGraphConfig type
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Dec 13, 2024
1 parent b9a11a1 commit 367d805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ConfigProvider/hooks/useConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function useGraphGlobalConfig(name: Charts) {
return mergeGraphOptions(graphConfig, componentConfig || {});
}

export function useGraphConfig<T extends GraphOptions>(
export function useGraphConfig<T extends Omit<GraphOptions, 'data'>>(
name: Charts,
defaultConfig: Partial<T>,
props: Partial<T>,
Expand Down
6 changes: 3 additions & 3 deletions src/FishboneDiagram/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GraphOptions } from '@ant-design/graphs';
import type { FishboneOptions } from '@ant-design/graphs';
import { Fishbone as ADCFishbone } from '@ant-design/graphs';
import React, { useMemo } from 'react';
import { useGraphConfig } from '../ConfigProvider/hooks';
Expand All @@ -7,7 +7,7 @@ import { visTreeData2GraphData } from '../utils/graph';

export interface FishboneDiagramProps extends TreeGraphProps {}

const defaultConfig: GraphOptions = {
const defaultConfig: FishboneOptions = {
autoFit: 'view',
autoResize: true,
};
Expand All @@ -17,7 +17,7 @@ const FishboneDiagram: React.FC<FishboneDiagramProps> = (props) => {

const data = useMemo(() => visTreeData2GraphData(propsData), [propsData]);

const config = useGraphConfig<GraphOptions>('FishboneDiagram', defaultConfig, restProps);
const config = useGraphConfig<FishboneOptions>('FishboneDiagram', defaultConfig, restProps);

return <ADCFishbone data={data} {...config} />;
};
Expand Down

0 comments on commit 367d805

Please sign in to comment.