Add types for get-certain

This commit is contained in:
Dimitri Benin
2018-12-09 00:07:13 +01:00
parent e95e11dcf2
commit e7d7df6004
4 changed files with 45 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
import getCertain = require('get-certain');
const map = new Map<string, number>();
map.set('foo', 1);
// $ExpectType number
getCertain(map, 'foo');
getCertain(map, 'bar', 'This map is barless.');
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for get-certain 1.0
// Project: https://github.com/wtgtybhertgeghgtwtg/get-certain#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = getCertain;
declare function getCertain<TKey, TValue>(
map: Map<TKey, TValue>,
key: TKey,
message?: string
): TValue;
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }