Skip to content

Examples of type parameters in README, tests? #231

Description

@ajvincent
export declare class Graph<GraphLabel = any, NodeLabel = any, EdgeLabel = any> {
 // ...
}

Okay, we have type parameters to define the shape of a NodeLabel, and an EdgeLabel. Nice. But there are no examples in the README or in the test code which defines an example graph.

type RecordGraph = Graph<Record<"graph", string>, Record<"node": string>, Record<"edge": string>>;
const graph: RecordGraph = new Graph({ directed: true, multigraph: true });

I suspect if there were some in the tests, they might reveal bugs in the type definitions. Or maybe the type definitions are correct, and an example would show us how to properly use them.

Please?

The any type is particularly dangerous, by the way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions