Merge pull request #30846 from BendingBender/randombytes

Add types for randombytes
This commit is contained in:
Andrew Casey
2018-12-04 10:47:46 -08:00
committed by GitHub
4 changed files with 47 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for randombytes 2.0
// Project: https://github.com/crypto-browserify/randombytes
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { randomBytes as _randomBytes } from 'crypto';
export = randomBytes;
declare const randomBytes: typeof _randomBytes;
+11
View File
@@ -0,0 +1,11 @@
import randomBytes = require('randombytes');
// $ExpectType Buffer
randomBytes(16);
// $ExpectType void
randomBytes(16, (err, resp) => {
// $ExpectType Error | null
err;
// $ExpectType Buffer
resp;
});
+23
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",
"randombytes-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }