diff --git a/types/bytewise/bytewise-tests.ts b/types/bytewise/bytewise-tests.ts new file mode 100644 index 0000000000..2641d4f785 --- /dev/null +++ b/types/bytewise/bytewise-tests.ts @@ -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')])); diff --git a/types/bytewise/index.d.ts b/types/bytewise/index.d.ts new file mode 100644 index 0000000000..c284ebee43 --- /dev/null +++ b/types/bytewise/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for bytewise 1.1 +// Project: https://github.com/deanlandolt/bytewise +// Definitions by: Daniel Byrne +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +interface Bytewise { + encode: (value: any) => Buffer; + decode: (value: Buffer) => any; + [k: string]: any; +} + +declare const bytewise: Bytewise; +export = bytewise; diff --git a/types/bytewise/tsconfig.json b/types/bytewise/tsconfig.json new file mode 100644 index 0000000000..acd527c7d2 --- /dev/null +++ b/types/bytewise/tsconfig.json @@ -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" + ] +} diff --git a/types/bytewise/tslint.json b/types/bytewise/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bytewise/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}