From 5f7c3a99b60a0f33252b0f280814a2963d40c626 Mon Sep 17 00:00:00 2001 From: YairTawil Date: Sun, 25 Jun 2017 09:48:26 +0300 Subject: [PATCH 1/3] add types for 'wellknown' --- types/wellknown/index.d.ts | 12 ++++++++++++ types/wellknown/tsconfig.json | 22 ++++++++++++++++++++++ types/wellknown/tslint.json | 1 + types/wellknown/wellknown-tests.ts | 7 +++++++ 4 files changed, 42 insertions(+) create mode 100644 types/wellknown/index.d.ts create mode 100644 types/wellknown/tsconfig.json create mode 100644 types/wellknown/tslint.json create mode 100644 types/wellknown/wellknown-tests.ts diff --git a/types/wellknown/index.d.ts b/types/wellknown/index.d.ts new file mode 100644 index 0000000000..a79f3236bf --- /dev/null +++ b/types/wellknown/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for wellknown 0.5 +// Project: https://github.com/mapbox/wellknown#readme +// Definitions by: Yair Tawil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = wellknown; + +declare namespace wellknown { + function parse(input: string): object; + function stringify(gj: {}): string; +} + diff --git a/types/wellknown/tsconfig.json b/types/wellknown/tsconfig.json new file mode 100644 index 0000000000..66be74a40f --- /dev/null +++ b/types/wellknown/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "wellknown-tests.ts" + ] +} diff --git a/types/wellknown/tslint.json b/types/wellknown/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/wellknown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/wellknown/wellknown-tests.ts b/types/wellknown/wellknown-tests.ts new file mode 100644 index 0000000000..7106927b88 --- /dev/null +++ b/types/wellknown/wellknown-tests.ts @@ -0,0 +1,7 @@ +import * as wellknown from './index'; +wellknown.parse("POINT(1 2)"); +const geoJson: {} = { + coordinates: [1, 2], + type: "Point" +}; +wellknown.stringify(geoJson); From 1331945eeac8aa15757ec697b8fa91f8f2e224af Mon Sep 17 00:00:00 2001 From: YairTawil Date: Mon, 26 Jun 2017 14:32:00 +0300 Subject: [PATCH 2/3] fix unit testing --- types/wellknown/index.d.ts | 9 ++------- types/wellknown/wellknown-tests.ts | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/types/wellknown/index.d.ts b/types/wellknown/index.d.ts index a79f3236bf..41a751c2d1 100644 --- a/types/wellknown/index.d.ts +++ b/types/wellknown/index.d.ts @@ -3,10 +3,5 @@ // Definitions by: Yair Tawil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = wellknown; - -declare namespace wellknown { - function parse(input: string): object; - function stringify(gj: {}): string; -} - +export declare function parse(input: string): {}; +export declare function stringify(gj: {}): string; diff --git a/types/wellknown/wellknown-tests.ts b/types/wellknown/wellknown-tests.ts index 7106927b88..0f1bcd656e 100644 --- a/types/wellknown/wellknown-tests.ts +++ b/types/wellknown/wellknown-tests.ts @@ -1,4 +1,4 @@ -import * as wellknown from './index'; +import * as wellknown from 'wellknown'; wellknown.parse("POINT(1 2)"); const geoJson: {} = { coordinates: [1, 2], From fb53f6e89d2a65d1eacb52f9286c91d31b336d6c Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Thu, 29 Jun 2017 13:32:52 -0700 Subject: [PATCH 3/3] Update index.d.ts fix linter issue --- types/wellknown/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/wellknown/index.d.ts b/types/wellknown/index.d.ts index 41a751c2d1..0b100e5c33 100644 --- a/types/wellknown/index.d.ts +++ b/types/wellknown/index.d.ts @@ -3,5 +3,5 @@ // Definitions by: Yair Tawil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export declare function parse(input: string): {}; -export declare function stringify(gj: {}): string; +export function parse(input: string): {}; +export function stringify(gj: {}): string;