From 45baf1fcd503d68fe45f76f8d62c68e03da83003 Mon Sep 17 00:00:00 2001 From: Daniel Byrne Date: Sat, 25 Aug 2018 13:30:06 -0700 Subject: [PATCH] adds typings for the 'toposort' package --- types/toposort/index.d.ts | 6 ++++++ types/toposort/toposort-tests.ts | 19 +++++++++++++++++++ types/toposort/tsconfig.json | 23 +++++++++++++++++++++++ types/toposort/tslint.json | 3 +++ 4 files changed, 51 insertions(+) create mode 100644 types/toposort/index.d.ts create mode 100644 types/toposort/toposort-tests.ts create mode 100644 types/toposort/tsconfig.json create mode 100644 types/toposort/tslint.json 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" +}