Skip to content

Commit

Permalink
馃 Merge PR #51082 add types for wordfilter by @mlc
Browse files Browse the repository at this point in the history
  • Loading branch information
mlc committed Feb 8, 2021
1 parent af3194a commit 27ccf29
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions types/wordfilter/index.d.ts
@@ -0,0 +1,9 @@
// Type definitions for wordfilter 0.2
// Project: https://github.com/dariusk/wordfilter
// Definitions by: mike castleman <https://github.com/mlc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export function blacklisted(string: string): boolean;
export function addWords(array: string | readonly string[]): void;
export function removeWord(word: string): void;
export function clearList(): void;
23 changes: 23 additions & 0 deletions types/wordfilter/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",
"wordfilter-tests.ts"
]
}
1 change: 1 addition & 0 deletions types/wordfilter/tslint.json
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
13 changes: 13 additions & 0 deletions types/wordfilter/wordfilter-tests.ts
@@ -0,0 +1,13 @@
import { blacklisted, addWords, removeWord, clearList } from 'wordfilter';

// $ExpectType boolean
blacklisted('this is some kind of string');

addWords('foo');
addWords(['bar', 'baz']);
// $ExpectError
addWords(3);

removeWord('foo');

clearList();

0 comments on commit 27ccf29

Please sign in to comment.