mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge pull request #34096 from ffflorian/nonogram-solver
Add types for nonogram-solver
This commit is contained in:
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for nonogram-solver 2.0
|
||||
// Project: https://github.com/thomasr/nonogram-solver
|
||||
// Definitions by: Florian Keller <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
declare namespace solve {
|
||||
class Puzzle {
|
||||
columnHints: number[][];
|
||||
height: number;
|
||||
rowHints: number[][];
|
||||
snapshot: number[];
|
||||
width: number;
|
||||
readonly isFinished: boolean;
|
||||
readonly isSolved: boolean;
|
||||
readonly svg: string;
|
||||
|
||||
constructor(data: string | Input);
|
||||
|
||||
import(puzzle: Puzzle): void;
|
||||
toJSON(): Required<Input>;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
puzzle: Puzzle;
|
||||
status: State;
|
||||
}
|
||||
|
||||
interface Input {
|
||||
columns: number[][];
|
||||
content?: State[];
|
||||
rows: number[][];
|
||||
}
|
||||
|
||||
type State = 0 | 1 | -1;
|
||||
}
|
||||
|
||||
declare function solve(filename: string): solve.Result;
|
||||
|
||||
export = solve;
|
||||
@@ -0,0 +1,10 @@
|
||||
import solve = require('nonogram-solver');
|
||||
|
||||
const { status, puzzle } = solve('input.json');
|
||||
|
||||
puzzle; // $ExpectType Puzzle
|
||||
puzzle.columnHints; // $ExpectType number[][]
|
||||
puzzle.isFinished; // $expectType boolean
|
||||
puzzle.svg; // $expectType string
|
||||
|
||||
status; // $ExpectType State
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"nonogram-solver-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user