From 65049e5d32551fdcba621ab616be0274fbec71cf Mon Sep 17 00:00:00 2001 From: Muhammad Ragib Hasin Date: Wed, 16 Aug 2017 23:02:24 +0600 Subject: [PATCH] [ascii2mathml][intl][remove-markdown] add typings (#18987) * [ascii2mathml] add typings (v0.5.4) * [intl] add typings * [remove-markdown] add typings * [ascii2mathml][intl][remove-markdown] fix lint * [intl] fix project link * [ascii2mathml] fix test error --- types/ascii2mathml/ascii2mathml-tests.ts | 17 +++++++++ types/ascii2mathml/index.d.ts | 35 +++++++++++++++++++ types/ascii2mathml/tsconfig.json | 22 ++++++++++++ types/ascii2mathml/tslint.json | 1 + types/intl/index.d.ts | 6 ++++ types/intl/intl-tests.ts | 1 + types/intl/tsconfig.json | 22 ++++++++++++ types/intl/tslint.json | 1 + types/remove-markdown/index.d.ts | 16 +++++++++ .../remove-markdown/remove-markdown-tests.ts | 5 +++ types/remove-markdown/tsconfig.json | 22 ++++++++++++ types/remove-markdown/tslint.json | 1 + 12 files changed, 149 insertions(+) create mode 100644 types/ascii2mathml/ascii2mathml-tests.ts create mode 100644 types/ascii2mathml/index.d.ts create mode 100644 types/ascii2mathml/tsconfig.json create mode 100644 types/ascii2mathml/tslint.json create mode 100644 types/intl/index.d.ts create mode 100644 types/intl/intl-tests.ts create mode 100644 types/intl/tsconfig.json create mode 100644 types/intl/tslint.json create mode 100644 types/remove-markdown/index.d.ts create mode 100644 types/remove-markdown/remove-markdown-tests.ts create mode 100644 types/remove-markdown/tsconfig.json create mode 100644 types/remove-markdown/tslint.json diff --git a/types/ascii2mathml/ascii2mathml-tests.ts b/types/ascii2mathml/ascii2mathml-tests.ts new file mode 100644 index 0000000000..9cb54443a4 --- /dev/null +++ b/types/ascii2mathml/ascii2mathml-tests.ts @@ -0,0 +1,17 @@ +import * as ascii2mathml from 'ascii2mathml'; + +let fn = ascii2mathml({}); // $ExpectType any +fn(''); // $ExpectType string +ascii2mathml('', {}); // $ExpectType string + +// $ExpectType string +ascii2mathml('', { + decimalMark: '.', + colSep: ',', + rowSep: ';', + display: 'inline', + dir: 'ltr', + bare: false, + standalone: false, + annotate: false +}); diff --git a/types/ascii2mathml/index.d.ts b/types/ascii2mathml/index.d.ts new file mode 100644 index 0000000000..2b02dfea15 --- /dev/null +++ b/types/ascii2mathml/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for ascii2mathml 0.5 +// Project: https://github.com/runarberg/ascii2mathml +// Definitions by: Muhammad Ragib Hasin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = A2MML; + +declare var A2MML: ascii2mathml; + +interface Options { + decimalMark?: string; + colSep?: string; + rowSep?: string; + display?: 'inline' | 'block'; + dir?: 'ltr' | 'rtl'; + bare?: boolean; + standalone?: boolean; + annotate?: boolean; +} + +interface ascii2mathml { + /** + * Generates a function with default options set to convert + * ASCIIMath expression to MathML markup. + * @param options Options + */ + (options: Options): ascii2mathml; + + /** + * Converts ASCIIMath expression to MathML markup. + * @param asciimath {string} ASCIIMath expression + * @param options Options + */ + (asciimath: string, options?: Options): string; +} diff --git a/types/ascii2mathml/tsconfig.json b/types/ascii2mathml/tsconfig.json new file mode 100644 index 0000000000..22e7823b58 --- /dev/null +++ b/types/ascii2mathml/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ascii2mathml-tests.ts" + ] +} diff --git a/types/ascii2mathml/tslint.json b/types/ascii2mathml/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ascii2mathml/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/intl/index.d.ts b/types/intl/index.d.ts new file mode 100644 index 0000000000..5a20583f99 --- /dev/null +++ b/types/intl/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for intl 1.2 +// Project: https://github.com/andyearnshaw/Intl.js +// Definitions by: Muhammad Ragib Hasin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = Intl; diff --git a/types/intl/intl-tests.ts b/types/intl/intl-tests.ts new file mode 100644 index 0000000000..0f005979f9 --- /dev/null +++ b/types/intl/intl-tests.ts @@ -0,0 +1 @@ +import * as intl from 'intl'; diff --git a/types/intl/tsconfig.json b/types/intl/tsconfig.json new file mode 100644 index 0000000000..520dc3c689 --- /dev/null +++ b/types/intl/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "intl-tests.ts" + ] +} diff --git a/types/intl/tslint.json b/types/intl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/remove-markdown/index.d.ts b/types/remove-markdown/index.d.ts new file mode 100644 index 0000000000..6268109366 --- /dev/null +++ b/types/remove-markdown/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for remove-markdown 0.1 +// Project: https://github.com/stiang/remove-markdown +// Definitions by: Muhammad Ragib Hasin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = RemoveMarkdown; + +/** + * Strip Markdown formatting from text + * @param markdown Markdown text + * @param options + */ +declare function RemoveMarkdown(markdown: string, options?: { + stripListLeaders?: boolean + gfm?: boolean +}): string; diff --git a/types/remove-markdown/remove-markdown-tests.ts b/types/remove-markdown/remove-markdown-tests.ts new file mode 100644 index 0000000000..ebb5dad298 --- /dev/null +++ b/types/remove-markdown/remove-markdown-tests.ts @@ -0,0 +1,5 @@ +import removeMd = require('remove-markdown'); + +removeMd(''); // $ExpectType string +removeMd('', {}); // $ExpectType string +removeMd('', { stripListLeaders: true, gfm: true }); // $ExpectType string diff --git a/types/remove-markdown/tsconfig.json b/types/remove-markdown/tsconfig.json new file mode 100644 index 0000000000..5b65d8fd41 --- /dev/null +++ b/types/remove-markdown/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "remove-markdown-tests.ts" + ] +} diff --git a/types/remove-markdown/tslint.json b/types/remove-markdown/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/remove-markdown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }