chore(useNodesData): cleanup return type

This commit is contained in:
moklick
2024-02-26 14:13:12 +01:00
parent 89a90cb848
commit 3fc3b7e603
6 changed files with 24 additions and 43 deletions
+2 -12
View File
@@ -20,18 +20,8 @@ export interface NodeDataReturn<NodeType extends Node> {
*/
export function useNodesData<NodeType extends Node = Node>(
nodeId: string
): {
id: string;
type: NodeType['type'];
data: NodeType['data'];
} | null;
export function useNodesData<NodeType extends Node = Node>(
nodeIds: string[]
): {
id: string;
type: NodeType['type'];
data: NodeType['data'];
}[];
): Pick<NodeType, 'id' | 'type' | 'data'> | null;
export function useNodesData<NodeType extends Node = Node>(nodeIds: string[]): Pick<NodeType, 'id' | 'type' | 'data'>[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function useNodesData(nodeIds: any): any {
const nodesData = useStore(