mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
minimal-bit-array: Initial commit (#27501)
This commit is contained in:
26
types/minimal-bit-array/index.d.ts
vendored
Normal file
26
types/minimal-bit-array/index.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Type definitions for minimal-bit-array 1.0
|
||||
// Project: https://github.com/mikolalysenko/minimal-bit-array
|
||||
// Definitions by: Olegs Jeremejevs <https://github.com/jeremejevs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace BitArray {
|
||||
interface BitArrayJSON {
|
||||
bits: number[];
|
||||
length: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare class BitArray {
|
||||
static fromJSON(bitArrayJSON: BitArray.BitArrayJSON): BitArray;
|
||||
|
||||
length: number;
|
||||
bits: Uint32Array;
|
||||
|
||||
constructor(length: number);
|
||||
|
||||
get(index: number): boolean;
|
||||
set(index: number, value: any): boolean;
|
||||
toJSON(): BitArray.BitArrayJSON;
|
||||
}
|
||||
|
||||
export = BitArray;
|
||||
9
types/minimal-bit-array/minimal-bit-array-tests.ts
Normal file
9
types/minimal-bit-array/minimal-bit-array-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as BitArray from "minimal-bit-array";
|
||||
|
||||
new BitArray('abc'); // $ExpectError
|
||||
const bitArray: BitArray = new BitArray(123);
|
||||
bitArray.get(12); // $ExpectType boolean
|
||||
bitArray.set(34, true); // $ExpectType boolean
|
||||
bitArray.set(34, 'someTruthyValue');
|
||||
const json: BitArray.BitArrayJSON = bitArray.toJSON();
|
||||
const bitArrayClone: BitArray = BitArray.fromJSON(json);
|
||||
23
types/minimal-bit-array/tsconfig.json
Normal file
23
types/minimal-bit-array/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"minimal-bit-array-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/minimal-bit-array/tslint.json
Normal file
1
types/minimal-bit-array/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user