Skip to content

Commit

Permalink
Add types to randomatic (DefinitelyTyped#45822)
Browse files Browse the repository at this point in the history
* Add types to randomatic

* Include definition author for randomatic
  • Loading branch information
execfera authored and danielrearden committed Sep 22, 2020
1 parent 68474f7 commit 77f61c1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions types/randomatic/index.d.ts
@@ -0,0 +1,15 @@
// Type definitions for randomatic 3.1
// Project: https://github.com/jonschlinkert/randomatic
// Definitions by: Frelia <https://github.com/execfera>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare function randomatic(p: string, l?: number, options?: {
chars?: string;
exclude?: string | string[];
}): string;

declare namespace randomatic {
const isCrypto: boolean;
}

export = randomatic;
5 changes: 5 additions & 0 deletions types/randomatic/randomatic-tests.ts
@@ -0,0 +1,5 @@
import * as randomize from 'randomatic';

randomize('*', 10); // $ExpectedType string
randomize('?', 20, { chars: 'jonschlinkert' }); // $ExpectedType string
randomize('*', 20, { exclude: '0oOiIlL1' }); // $ExpectedType string
23 changes: 23 additions & 0 deletions types/randomatic/tsconfig.json
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"randomatic-tests.ts"
]
}
1 change: 1 addition & 0 deletions types/randomatic/tslint.json
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit 77f61c1

Please sign in to comment.