Add types to randomatic (#45822)

* Add types to randomatic

* Include definition author for randomatic
This commit is contained in:
Frelia 2020-07-07 05:07:56 +08:00 committed by GitHub
parent 7152e63617
commit 1882299f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 0 deletions

15
types/randomatic/index.d.ts vendored Normal file
View File

@ -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;

View File

@ -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

View File

@ -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"
]
}

View File

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