@types/toposort

TypeScript definitions for toposort

  • Types
  • ESM
  • CJS
License
MIT
Deps
0
Install Size
5 kB
Vulns
0
Published

Get started

$npm install @types/toposort
$pnpm add @types/toposort
$yarn add @types/toposort
$bun add @types/toposort
$deno add npm:@types/toposort
$vlt install @types/toposort
$vp add @types/toposort
# Usually installed as a dev dependency
$npm install -D @types/toposort
$pnpm add -D @types/toposort
$yarn add -D @types/toposort
$bun add -d @types/toposort
$deno add -D npm:@types/toposort
$vlt install -D @types/toposort
$vp add -D @types/toposort

Weekly DownloadsAcross all versions

Versions

View all versions
2.0.7
latestts4.5ts4.6ts4.7ts4.8ts4.9ts5.0ts5.1ts5.2ts5.3ts5.4ts5.5ts5.6ts5.7ts5.8ts5.9ts6.0
2.0.4
ts4.3ts4.4
2.0.3
ts2.3ts2.4ts2.5ts2.6ts2.7ts2.8ts2.9ts3.0ts3.1ts3.2ts3.3ts3.4ts3.5ts3.6ts3.7ts3.8ts3.9ts4.0ts4.1ts4.2
2.0.2
ts2.0ts2.1ts2.2

Readme

Installation

npm install --save @types/toposort

Summary

This package contains type definitions for toposort (https://github.com/marcelklehr/toposort).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/toposort.

index.d.ts

/**
 * @param edges An array of directed edges describing a graph. An edge looks
 *              like this: `[node1, node2]` (vertices needn't be strings but can
 *              be of any type).
 * @returns a list of vertices, sorted from "start" to "end"
 * @throws if there are any cycles in the graph
 */
declare function toposort<T = string>(edges: ReadonlyArray<[T, T | undefined]>): T[];
declare namespace toposort {
    /**
     * This is a convenience method that allows you to define nodes that may or
     * may not be connected to any other nodes. The ordering of unconnected
     * nodes is not defined.
     * @param nodes An array of nodes
     * @param edges An array of directed edges. You don't need to mention all
     *              `nodes` here.
     * @returns a list of vertices, sorted from "start" to "end"
     * @throws if there are any cycles in the graph
     */
    function array<T = string>(
        nodes: readonly T[],
        edges: ReadonlyArray<[T, T | undefined]>,
    ): T[];
}
export = toposort;
Additional Details
  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: none

Credits

These definitions were written by Daniel Byrne, Prokop Simek, and Emily Marigold Klassen.