Add [@strikeentco/get] type declarations (#38039)

* [@strikeentco/get] Added types for strikeentco's get

* [@strikeentco/get] Fixed common mistake array -> ReadonlyArray
This commit is contained in:
Elliott Campbell
2019-09-05 18:07:10 -05:00
committed by Andrew Casey
parent 71ce6eca63
commit 444fa06fdf
4 changed files with 43 additions and 0 deletions

9
types/strikeentco__get/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for @strikeentco/get 1.0
// Project: https://github.com/strikeentco/get
// Definitions by: Elliott Campbell <https://github.com/ElliottCampbellJHA>
// Erik Heikes <https://github.com/eheikes>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare function get(obj: object, paths: string | ReadonlyArray<string>, separator?: string): any;
export = get;

View File

@@ -0,0 +1,7 @@
import get = require('@strikeentco/get');
get({ a: { b: 'c' } }, 'a.b');
get({ a: { b: ['c', 'd'] } }, 'a.b.1');
get({ a: { b: ['c', 'd'] } }, ['a', 'b']);
get({ a: { b: 'c' } }, 'a.b.c.d');
get({ a: { b: 'c' } }, 'a:b', ':');

View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@strikeentco/get": ["strikeentco__get"]
}
},
"files": [
"index.d.ts",
"strikeentco__get-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }