mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add type definitions for "scrambo" (#42776)
* Add types for scrambo * Satisfy linter * Enable esModuleInterop * Get rid of esModuleInterop
This commit is contained in:
parent
328119f5f6
commit
f53fd2ba9c
51
types/scrambo/index.d.ts
vendored
Normal file
51
types/scrambo/index.d.ts
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
// Type definitions for scrambo 0.3
|
||||
// Project: https://github.com/nickcolley/scrambo
|
||||
// Definitions by: Christopher Mühl <https://github.com/padarom>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type NNN = '222' | '333' | '444' | '555' | '666' | '777';
|
||||
type ScrambleType = NNN | 'clock' | 'minx' | 'pyram' | 'sq1' | 'skewb';
|
||||
|
||||
declare class Scrambo {
|
||||
/**
|
||||
* Sets this instance's scrambler type and returns the original instance.
|
||||
* @param type
|
||||
*/
|
||||
type(type: ScrambleType): Scrambo;
|
||||
|
||||
/**
|
||||
* Returns the currently configured scrambler type.
|
||||
*/
|
||||
type(): ScrambleType;
|
||||
|
||||
/**
|
||||
* Sets this instance's seed and returns the original instance.
|
||||
* @param seed
|
||||
*/
|
||||
seed(seed: number): Scrambo;
|
||||
|
||||
/**
|
||||
* Returns the current seed type of this scrambler.
|
||||
*/
|
||||
seed(): number;
|
||||
|
||||
/**
|
||||
* Sets this instance's scramble length and returns the original instance.
|
||||
* @param length
|
||||
*/
|
||||
length(length: number): Scrambo;
|
||||
|
||||
/**
|
||||
* Returns the currently configured scramble length.
|
||||
*/
|
||||
length(): number;
|
||||
|
||||
/**
|
||||
* Returns an array of random scrambles with the given length
|
||||
* for the configured scrambler type.
|
||||
* @param number defaults to 1
|
||||
*/
|
||||
get(number?: number): [string];
|
||||
}
|
||||
|
||||
export = Scrambo;
|
||||
11
types/scrambo/scrambo-tests.ts
Normal file
11
types/scrambo/scrambo-tests.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import Scrambo = require('scrambo');
|
||||
|
||||
(async () => {
|
||||
const scrambo = new Scrambo();
|
||||
scrambo.seed(15000);
|
||||
|
||||
const originalType = scrambo.type();
|
||||
|
||||
scrambo.type('minx').length(15).get();
|
||||
scrambo.type(originalType).get(5);
|
||||
})();
|
||||
23
types/scrambo/tsconfig.json
Normal file
23
types/scrambo/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"scrambo-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/scrambo/tslint.json
Normal file
1
types/scrambo/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user