From e7d7df60048dade1c23540c06ccf75e141a05b44 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sun, 9 Dec 2018 00:07:13 +0100 Subject: [PATCH] Add types for get-certain --- types/get-certain/get-certain-tests.ts | 9 +++++++++ types/get-certain/index.d.ts | 12 ++++++++++++ types/get-certain/tsconfig.json | 23 +++++++++++++++++++++++ types/get-certain/tslint.json | 1 + 4 files changed, 45 insertions(+) create mode 100644 types/get-certain/get-certain-tests.ts create mode 100644 types/get-certain/index.d.ts create mode 100644 types/get-certain/tsconfig.json create mode 100644 types/get-certain/tslint.json diff --git a/types/get-certain/get-certain-tests.ts b/types/get-certain/get-certain-tests.ts new file mode 100644 index 0000000000..fde423095c --- /dev/null +++ b/types/get-certain/get-certain-tests.ts @@ -0,0 +1,9 @@ +import getCertain = require('get-certain'); + +const map = new Map(); + +map.set('foo', 1); + +// $ExpectType number +getCertain(map, 'foo'); +getCertain(map, 'bar', 'This map is barless.'); diff --git a/types/get-certain/index.d.ts b/types/get-certain/index.d.ts new file mode 100644 index 0000000000..bbde669d19 --- /dev/null +++ b/types/get-certain/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for get-certain 1.0 +// Project: https://github.com/wtgtybhertgeghgtwtg/get-certain#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = getCertain; + +declare function getCertain( + map: Map, + key: TKey, + message?: string +): TValue; diff --git a/types/get-certain/tsconfig.json b/types/get-certain/tsconfig.json new file mode 100644 index 0000000000..777807992c --- /dev/null +++ b/types/get-certain/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "get-certain-tests.ts" + ] +} diff --git a/types/get-certain/tslint.json b/types/get-certain/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/get-certain/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }