diff --git a/types/sparkly/index.d.ts b/types/sparkly/index.d.ts new file mode 100644 index 0000000000..3e1e5529a6 --- /dev/null +++ b/types/sparkly/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for sparkly 3.1 +// Project: https://github.com/sindresorhus/sparkly +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = sparkly; + +declare function sparkly(numbers: Array, options?: sparkly.Options): string; + +declare namespace sparkly { + interface Options { + min?: number; + max?: number; + style?: 'fire'; + } +} diff --git a/types/sparkly/sparkly-tests.ts b/types/sparkly/sparkly-tests.ts new file mode 100644 index 0000000000..cd5fa262e0 --- /dev/null +++ b/types/sparkly/sparkly-tests.ts @@ -0,0 +1,7 @@ +import sparkly = require('sparkly'); + +let str: string; +str = sparkly([0, 3, 5, 8, 4, 3, 4, 10]); +str = sparkly([0, 3, 5, '', 4, 3, 4, 10]); +str = sparkly([1, 2, 3, 4, 5], {min: 0, max: 10}); +str = sparkly([1, 2, 3, 4, 5, 6, 7, 8], {style: 'fire'}); diff --git a/types/sparkly/tsconfig.json b/types/sparkly/tsconfig.json new file mode 100644 index 0000000000..f439b0a2e7 --- /dev/null +++ b/types/sparkly/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sparkly-tests.ts" + ] +} diff --git a/types/sparkly/tslint.json b/types/sparkly/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sparkly/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }