added types for camelcase-keys-deep (#35458)

* added types for camelcase-keys-deep

* Refactored test file and removed namespace declaration from index.d.ts
This commit is contained in:
Søren Englund 2019-05-15 18:51:38 +02:00 committed by Nathan Shively-Sanders
parent 36e47f5333
commit 0efa64a8ba
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import camelcaseKeysDeep = require('camelcase-keys-deep');
interface Point {
point_x: number;
point_y: number;
}
const foo: Point = {
point_x: 1,
point_y: 2,
};
camelcaseKeysDeep(foo) as Point; // => {pointX: 1, pointY: 2}
camelcaseKeysDeep({ unicorn_rainbow: { foo_bar: 1 } }); // => unicornRainbow: {fooBar: 1}

9
types/camelcase-keys-deep/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for camelcase-keys-deep 0.1
// Project: https://github.com/rxaviers/camelcase-keys-deep
// Definitions by: Søren Englund <https://github.com/englund0110>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
declare function camelcaseKeysDeep(obj: object): {};
export = camelcaseKeysDeep;

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",
"camelcase-keys-deep-tests.ts"
]
}

View File

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