Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge should accept a generic type argument like Node #4283

Closed
kevinschaich opened this issue May 16, 2024 · 2 comments
Closed

Edge should accept a generic type argument like Node #4283

kevinschaich opened this issue May 16, 2024 · 2 comments

Comments

@kevinschaich
Copy link

kevinschaich commented May 16, 2024

Definition for Node:

export type Node<T = any, U extends string | undefined = string | undefined> = {
    id: string;
    data: T;
    type?: U;
    ...
}

Usage:

export type MyNode = Node<MyNodeData, 'my-node'>

Perfect. The def for Edge is inconsistent:

export type Edge<T = any> = DefaultEdge<T> | SmoothStepEdgeType<T> | BezierEdgeType<T>;

...

type DefaultEdge<T = any> = {
    id: string;
    data?: T;
    type?: string;
    ...
}

This means you can't enforce that generic props map to a discrete number of edge types throughout your app.

@kevinschaich
Copy link
Author

Actually should mention I'm on v11 and these are the exported types I'm seeing. Maybe fixed in:

cc: @moklick ? Happy to close out if so

@moklick
Copy link
Member

moklick commented May 16, 2024

@moklick moklick closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants