From 6b263a388c3bddde00ae05d8e574733ca479be96 Mon Sep 17 00:00:00 2001 From: Tuan Anh Tran Date: Thu, 8 Feb 2018 10:46:52 +0700 Subject: [PATCH 1/2] feat: add type for camaro --- types/camaro/camaro-tests.ts | 3 +++ types/camaro/index.d.ts | 12 ++++++++++++ types/camaro/tsconfig.json | 24 ++++++++++++++++++++++++ types/camaro/tslint.json | 1 + 4 files changed, 40 insertions(+) create mode 100644 types/camaro/camaro-tests.ts create mode 100644 types/camaro/index.d.ts create mode 100644 types/camaro/tsconfig.json create mode 100644 types/camaro/tslint.json diff --git a/types/camaro/camaro-tests.ts b/types/camaro/camaro-tests.ts new file mode 100644 index 0000000000..4644c13a17 --- /dev/null +++ b/types/camaro/camaro-tests.ts @@ -0,0 +1,3 @@ +import transform = require('camaro'); + +const x: Object = transform('text', { text: 'root/child'}); diff --git a/types/camaro/index.d.ts b/types/camaro/index.d.ts new file mode 100644 index 0000000000..d220b3d285 --- /dev/null +++ b/types/camaro/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for camaro 2.2.4 +// Project: https://github.com/tuananh/camaro +// Definitions by: Tuan Anh Tran +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Transform the input xml to json using the input template object + * @param input The input xml string + * @param template The output template + */ +declare function transform(input: string, template: Object): Object; +export = transform; diff --git a/types/camaro/tsconfig.json b/types/camaro/tsconfig.json new file mode 100644 index 0000000000..5ebe7d3bb9 --- /dev/null +++ b/types/camaro/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "camaro-tests.ts" + ] +} \ No newline at end of file diff --git a/types/camaro/tslint.json b/types/camaro/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/camaro/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b8029826051a3dd07a8cd35a00371cdc7bbf3d6c Mon Sep 17 00:00:00 2001 From: Tuan Anh Tran Date: Thu, 8 Feb 2018 11:02:09 +0700 Subject: [PATCH 2/2] fix: ts version 2.2 --- types/camaro/camaro-tests.ts | 2 +- types/camaro/index.d.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/types/camaro/camaro-tests.ts b/types/camaro/camaro-tests.ts index 4644c13a17..b99b0201c3 100644 --- a/types/camaro/camaro-tests.ts +++ b/types/camaro/camaro-tests.ts @@ -1,3 +1,3 @@ import transform = require('camaro'); -const x: Object = transform('text', { text: 'root/child'}); +const x: object = transform('text', { text: 'root/child'}); diff --git a/types/camaro/index.d.ts b/types/camaro/index.d.ts index d220b3d285..5d8b8e5bae 100644 --- a/types/camaro/index.d.ts +++ b/types/camaro/index.d.ts @@ -1,12 +1,13 @@ -// Type definitions for camaro 2.2.4 +// Type definitions for camaro 2.2 // Project: https://github.com/tuananh/camaro // Definitions by: Tuan Anh Tran // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /** - * Transform the input xml to json using the input template object + * Transform the input xml to json using the input template object. * @param input The input xml string * @param template The output template */ -declare function transform(input: string, template: Object): Object; +declare function transform(input: string, template: object): object; export = transform;