diff --git a/types/toposort/index.d.ts b/types/toposort/index.d.ts new file mode 100644 index 0000000000..8da78b7d11 --- /dev/null +++ b/types/toposort/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for toposort 2.0 +// Project: https://github.com/marcelklehr/toposort +// Definitions by: Daniel Byrne +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function toposort(graph: ReadonlyArray<[string, string]>): ReadonlyArray; diff --git a/types/toposort/toposort-tests.ts b/types/toposort/toposort-tests.ts new file mode 100644 index 0000000000..201277fefa --- /dev/null +++ b/types/toposort/toposort-tests.ts @@ -0,0 +1,19 @@ +import toposort from 'toposort'; + +const testGraph: ReadonlyArray<[string, string]> = [ + [ + 'string1', + 'string2', + ], + [ + 'string2', + 'string3', + ], + [ + 'string3', + 'string1', + ], +]; + +// $ExpectType ReadonlyArray +toposort(testGraph); diff --git a/types/toposort/tsconfig.json b/types/toposort/tsconfig.json new file mode 100644 index 0000000000..3524da0d19 --- /dev/null +++ b/types/toposort/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "toposort-tests.ts" + ] +} diff --git a/types/toposort/tslint.json b/types/toposort/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/toposort/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}