diff --git a/types/markdown-escape/index.d.ts b/types/markdown-escape/index.d.ts new file mode 100644 index 00000000000000..e2367cf709b86e --- /dev/null +++ b/types/markdown-escape/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for markdown-escape 1.1 +// Project: https://github.com/kemitchell/markdown-escape.js +// Definitions by: Christoph Thiede +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type CharacterSets = [ + 'asterisks', + 'number signs', + 'slashes', + 'parentheses', + 'parentheses', + 'square brackets', + 'square brackets', + 'angle brackets', + 'angle brackets', + 'underscores' +]; + +declare namespace markdownEscape { + type CharacterSet = CharacterSets[number]; +} + +declare function markdownEscape(string: string, skips?: markdownEscape.CharacterSet[]): string; + +export = markdownEscape; diff --git a/types/markdown-escape/markdown-escape-tests.ts b/types/markdown-escape/markdown-escape-tests.ts new file mode 100644 index 00000000000000..3e2d4eaa8a1d9c --- /dev/null +++ b/types/markdown-escape/markdown-escape-tests.ts @@ -0,0 +1,10 @@ +import * as markdownEscape from 'markdown-escape'; + +// $ExpectType string +markdownEscape("#1! We're #1!"); + +// $ExpectType string +markdownEscape('one (1)', ['parentheses']); + +const characterSet: markdownEscape.CharacterSet = 'asterisks'; +const string: string = characterSet; diff --git a/types/markdown-escape/tsconfig.json b/types/markdown-escape/tsconfig.json new file mode 100644 index 00000000000000..0ee5e4571708c0 --- /dev/null +++ b/types/markdown-escape/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", + "markdown-escape-tests.ts" + ] +} diff --git a/types/markdown-escape/tslint.json b/types/markdown-escape/tslint.json new file mode 100644 index 00000000000000..f93cf8562ad24d --- /dev/null +++ b/types/markdown-escape/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}