Add type definitions for nanoid-dictionary (#45918)

* Add type definitions for nanoid-dictionary

* Support use specific dictionary only

As per comment of peterblazejewicz https://github.com/DefinitelyTyped/DefinitelyTyped/pull/45918

* Import types from files to avoid duplicate definitions
This commit is contained in:
kenelm007 2020-07-07 12:11:17 -07:00 committed by GitHub
parent f09343c25f
commit 84e08dbd90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 72 additions and 0 deletions

9
types/nanoid-dictionary/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for nanoid-dictionary 3.0
// Project: https://github.com/CyberAP/nanoid-dictionary#readme
// Definitions by: Shengjie Pan <https://github.com/kenelm007>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export import lowercase = require('./lowercase');
export import uppercase = require('./uppercase');
export import numbers = require('./numbers');
export import nolookalikes = require('./nolookalikes');

View File

@ -0,0 +1,6 @@
/**
* Lowercase English letters
*/
declare const lowercase: string;
export = lowercase;

View File

@ -0,0 +1,15 @@
import dict = require('nanoid-dictionary');
import lowercase = require('nanoid-dictionary/lowercase');
import uppercase = require('nanoid-dictionary/uppercase');
import numbers = require('nanoid-dictionary/numbers');
import nolookalikes = require('nanoid-dictionary/nolookalikes');
dict.lowercase; // $ExpectType string
dict.uppercase; // $ExpectType string
dict.numbers; // $ExpectType string
dict.nolookalikes; // $ExpectType string
lowercase; // $ExpectType string
uppercase; // $ExpectType string
numbers; // $ExpectType string
nolookalikes; // $ExpectType string

View File

@ -0,0 +1,6 @@
/**
* Numbers and english alphabet without lookalikes
*/
declare const nolookalikes: string;
export = nolookalikes;

6
types/nanoid-dictionary/numbers.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Numbers from 0 to 9
*/
declare const numbers: string;
export = numbers;

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",
"nanoid-dictionary-tests.ts"
]
}

View File

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

View File

@ -0,0 +1,6 @@
/**
* Uppercase English letters
*/
declare const uppercase: string;
export = uppercase;