adds basic typings for the 'bytewise' package

This commit is contained in:
Daniel Byrne
2018-09-18 12:00:24 -07:00
parent da27f96b91
commit 21e152e0ea
4 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import bytewise = require('bytewise');
// $ExpectType Buffer
bytewise.encode([1, 2, 3]);
// $ExpectType any
bytewise.decode(bytewise.encode([1, 2 , 3]));
// $ExpectType Buffer
bytewise.encode(bytewise.sorts.array.bound.lower(['123', -1, 0x123, Buffer.from('test')]));

16
types/bytewise/index.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
// Type definitions for bytewise 1.1
// Project: https://github.com/deanlandolt/bytewise
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types= "node" />
interface Bytewise {
encode: (value: any) => Buffer;
decode: (value: Buffer) => any;
[k: string]: any;
}
declare const bytewise: Bytewise;
export = bytewise;

View File

@@ -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",
"bytewise-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}