mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[sparkly] introduce typings (#18291)
* [sparkly] introduce typings * [sparkly] restrict input type to allow all types from examples but not more than that
This commit is contained in:
committed by
Wesley Wigham
parent
c469f9c606
commit
42e60e5283
16
types/sparkly/index.d.ts
vendored
Normal file
16
types/sparkly/index.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for sparkly 3.1
|
||||
// Project: https://github.com/sindresorhus/sparkly
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = sparkly;
|
||||
|
||||
declare function sparkly(numbers: Array<number | ''>, options?: sparkly.Options): string;
|
||||
|
||||
declare namespace sparkly {
|
||||
interface Options {
|
||||
min?: number;
|
||||
max?: number;
|
||||
style?: 'fire';
|
||||
}
|
||||
}
|
||||
7
types/sparkly/sparkly-tests.ts
Normal file
7
types/sparkly/sparkly-tests.ts
Normal file
@@ -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'});
|
||||
22
types/sparkly/tsconfig.json
Normal file
22
types/sparkly/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/sparkly/tslint.json
Normal file
1
types/sparkly/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user