Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typescript typings #27

Merged
merged 4 commits into from Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## main

* Adds typescript typings

## 1.1.2 - 2022-01-20

* Updates mocha to v9.
Expand Down
18 changes: 18 additions & 0 deletions index.d.ts
@@ -0,0 +1,18 @@
declare type WordsOptions = {
min?: number;
max?: number;
exactly?: number;
maxLength?: number;
wordsPerString?: number;
seperator?: string;
formatter?: (word: string, index: number) => string;
};

declare type JoinedWordsOptions = WordsOptions & { join: string; };

declare function words(count: number): string[];
declare function words(options: WordsOptions): string[];
declare function words(options: JoinedWordsOptions): string;

export const wordsList: string[];
export default words;
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.2",
"description": "Generate one or more common English words",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"test": "mocha tests/test.js"
},
Expand Down