mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for dependency-solver (#46119)
Co-authored-by: Justus Fluegel <klettelars@gmail.com>
This commit is contained in:
parent
216303eaa9
commit
68a8df69f2
8
types/dependency-solver/dependency-solver-tests.ts
Normal file
8
types/dependency-solver/dependency-solver-tests.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { addMissingKeys, getDependedBy, getDependencyLines, getEdges, getInDegree, solve } from 'dependency-solver';
|
||||
|
||||
const graph: { [key: string]: string[] } = addMissingKeys({ a: ['b', 'c'], c: ['b'] });
|
||||
const dependedBy_1: { [key: string]: number } = getDependedBy({ a: ['b', 'c'], c: ['b'] });
|
||||
const dependedBy_2: { [key: string]: number } = getEdges({ a: ['b', 'c'], c: ['b'] });
|
||||
const dependencyLines_1: Array<[string, string]> = getDependencyLines({ a: ['b', 'c'], c: ['b'] });
|
||||
const dependencyLines_2: Array<[string, string]> = getInDegree({ a: ['b', 'c'], c: ['b'] });
|
||||
const solved: string[] = solve({ a: ['b', 'c'], c: ['b'] });
|
||||
34
types/dependency-solver/index.d.ts
vendored
Normal file
34
types/dependency-solver/index.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Type definitions for dependency-solver 1.0
|
||||
// Project: https://github.com/haavistu/dependency-solver#readme
|
||||
// Definitions by: Justus Fluegel <https://github.com/Technikkeller>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Solve dependency graph
|
||||
*
|
||||
* @param g dependency graph
|
||||
*/
|
||||
export function solve(g: { [key: string]: string[] }): string[];
|
||||
|
||||
/**
|
||||
* Add missing keys for dependencies of other nodes
|
||||
*
|
||||
* @param g dependency graph
|
||||
*/
|
||||
export function addMissingKeys(g: { [key: string]: string[] }): { [key: string]: string[] };
|
||||
|
||||
/**
|
||||
* Get numbers of dependants for each node
|
||||
*
|
||||
* @param g dependency graph
|
||||
*/
|
||||
export function getEdges(g: { [key: string]: string[] }): { [key: string]: number };
|
||||
|
||||
/**
|
||||
* Get relations between dependencies, eg. the lines in a tree diagramm
|
||||
*
|
||||
* @param g dependency graph
|
||||
*/
|
||||
export function getInDegree(g: { [key: string]: string[] }): Array<[string, string]>;
|
||||
|
||||
export { getEdges as getDependedBy, getInDegree as getDependencyLines };
|
||||
23
types/dependency-solver/tsconfig.json
Normal file
23
types/dependency-solver/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dependency-solver-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/dependency-solver/tslint.json
Normal file
1
types/dependency-solver/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user