diff --git a/types/sequencify/index.d.ts b/types/sequencify/index.d.ts new file mode 100644 index 0000000000..526baa8f54 --- /dev/null +++ b/types/sequencify/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for sequencify 0.1 +// Project: https://github.com/robrich/sequencify +// Definitions by: Nicolas Penin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Definition file started by dts-gen +// TypeScript Version: 2.1 + +export = sequencify; + +declare namespace sequencify { + interface Task { + name: string; + dep: string[]; + } + + interface TaskMap { + [name: string]: Task; + } +} + +declare function sequencify(tasks: T, names: Array, results: Array, nest?: string[]): void; diff --git a/types/sequencify/sequencify-tests.ts b/types/sequencify/sequencify-tests.ts new file mode 100644 index 0000000000..26506d7fbd --- /dev/null +++ b/types/sequencify/sequencify-tests.ts @@ -0,0 +1,34 @@ +/* Add tests for your definition file here */ + +/// + +import sequencify = require('sequencify'); + +const items: sequencify.TaskMap = { + a: { + name: 'a', + dep: [] + // other properties as needed + }, + b: { + name: 'b', + dep: ['a'] + }, + c: { + name: 'c', + dep: ['a'] + }, + d: { + name: 'd', + dep: ['c'] + }, +}; + +const names = ['d', 'b', 'c', 'a']; // The names of the items you want arranged, need not be all + +const results: string[] = []; + +sequencify(items, names, results); + +console.log(results); +// ['a','b','c','d']; diff --git a/types/sequencify/tsconfig.json b/types/sequencify/tsconfig.json new file mode 100644 index 0000000000..fb43176f7c --- /dev/null +++ b/types/sequencify/tsconfig.json @@ -0,0 +1,23 @@ +{ + "files": [ + "index.d.ts", + "sequencify-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "lib": [ + "es6" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/sequencify/tslint.json b/types/sequencify/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/sequencify/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file