From aeafe3ea2d8a2306657a034e6d83a00d12a5f9ad Mon Sep 17 00:00:00 2001 From: Mendy Berger <12537668+MendyBerger@users.noreply.github.com> Date: Mon, 5 Aug 2019 15:41:49 -0400 Subject: [PATCH] Added gematriya types (#37361) --- types/gematriya/index.d.ts | 10 ++++++++ .../gematriya/test/gematriya-global-tests.ts | 11 +++++++++ .../gematriya/test/gematriya-module-tests.ts | 13 ++++++++++ types/gematriya/tsconfig.json | 24 +++++++++++++++++++ types/gematriya/tslint.json | 1 + 5 files changed, 59 insertions(+) create mode 100644 types/gematriya/index.d.ts create mode 100644 types/gematriya/test/gematriya-global-tests.ts create mode 100644 types/gematriya/test/gematriya-module-tests.ts create mode 100644 types/gematriya/tsconfig.json create mode 100644 types/gematriya/tslint.json diff --git a/types/gematriya/index.d.ts b/types/gematriya/index.d.ts new file mode 100644 index 0000000000..ae77b0df10 --- /dev/null +++ b/types/gematriya/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for gematriya 2.0 +// Project: https://github.com/Scimonster/js-gematriya +// Definitions by: Mendy Berger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare global { + function gematriya(num: number, options?: { limit?: number, punctuate?: boolean, geresh?: boolean }): string; + function gematriya(str: string, options?: { order?: boolean }): number; +} +export = gematriya; diff --git a/types/gematriya/test/gematriya-global-tests.ts b/types/gematriya/test/gematriya-global-tests.ts new file mode 100644 index 0000000000..0535efddbb --- /dev/null +++ b/types/gematriya/test/gematriya-global-tests.ts @@ -0,0 +1,11 @@ +gematriya(5774); // $ExpectType string +gematriya(5774, {limit: 3}); // $ExpectType string +gematriya(5774, {limit: 7}); // $ExpectType string +gematriya(5774, {punctuate: false}); // $ExpectType string +gematriya(5774, {punctuate: true}); // $ExpectType string +gematriya(5774, {geresh: false}); // $ExpectType string +gematriya(5774, {punctuate: false, limit: 3}); // $ExpectType string +gematriya(3); // $ExpectType string +gematriya(3, {geresh: false}); // $ExpectType string +gematriya('התשעד', {order: true}); // $ExpectType number +gematriya('התשעד', {order: false}); // $ExpectType number diff --git a/types/gematriya/test/gematriya-module-tests.ts b/types/gematriya/test/gematriya-module-tests.ts new file mode 100644 index 0000000000..a209e033e5 --- /dev/null +++ b/types/gematriya/test/gematriya-module-tests.ts @@ -0,0 +1,13 @@ +import gematriya = require("gematriya"); + +gematriya(5774); // $ExpectType string +gematriya(5774, {limit: 3}); // $ExpectType string +gematriya(5774, {limit: 7}); // $ExpectType string +gematriya(5774, {punctuate: false}); // $ExpectType string +gematriya(5774, {punctuate: true}); // $ExpectType string +gematriya(5774, {geresh: false}); // $ExpectType string +gematriya(5774, {punctuate: false, limit: 3}); // $ExpectType string +gematriya(3); // $ExpectType string +gematriya(3, {geresh: false}); // $ExpectType string +gematriya('התשעד', {order: true}); // $ExpectType number +gematriya('התשעד', {order: false}); // $ExpectType number diff --git a/types/gematriya/tsconfig.json b/types/gematriya/tsconfig.json new file mode 100644 index 0000000000..82daaa3480 --- /dev/null +++ b/types/gematriya/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/gematriya-module-tests.ts", + "test/gematriya-global-tests.ts" + ] +} diff --git a/types/gematriya/tslint.json b/types/gematriya/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gematriya/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }