From fb3f0de44e7d55644f47529da46c3ad61c35d5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Matthies?= Date: Thu, 6 Feb 2020 00:15:30 +0100 Subject: [PATCH] Add definitions for smshelper (#42061) --- types/smshelper/index.d.ts | 10 ++++++++++ types/smshelper/smshelper-tests.ts | 7 +++++++ types/smshelper/tsconfig.json | 23 +++++++++++++++++++++++ types/smshelper/tslint.json | 1 + 4 files changed, 41 insertions(+) create mode 100644 types/smshelper/index.d.ts create mode 100644 types/smshelper/smshelper-tests.ts create mode 100644 types/smshelper/tsconfig.json create mode 100644 types/smshelper/tslint.json diff --git a/types/smshelper/index.d.ts b/types/smshelper/index.d.ts new file mode 100644 index 0000000000..88ec20a160 --- /dev/null +++ b/types/smshelper/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for smshelper 0.1 +// Project: https://github.com/jaygel179/smshelper.js#readme +// Definitions by: André Matthies +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function count(text: string): number; + +export function detectEncoding(text: string): 'GSM_7BIT' | 'GSM_7BIT_EX' | 'UTF16'; + +export function parts(text: string): number; diff --git a/types/smshelper/smshelper-tests.ts b/types/smshelper/smshelper-tests.ts new file mode 100644 index 0000000000..343b9a1c19 --- /dev/null +++ b/types/smshelper/smshelper-tests.ts @@ -0,0 +1,7 @@ +import * as smshelper from 'smshelper'; + +const charCount = smshelper.count('MY_RANDOM_MESSAGE'); + +const encoding = smshelper.detectEncoding('MY_RANDOM_MESSAGE'); + +const smsCount = smshelper.parts('MY_RANDOM_MESSAGE'); diff --git a/types/smshelper/tsconfig.json b/types/smshelper/tsconfig.json new file mode 100644 index 0000000000..63edc92d66 --- /dev/null +++ b/types/smshelper/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", + "smshelper-tests.ts" + ] +} diff --git a/types/smshelper/tslint.json b/types/smshelper/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/smshelper/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }