From 1510f150cf0f02ee60129cb8731fd82fee264622 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 7 Nov 2016 10:05:41 -0800 Subject: [PATCH] Improve jstimezonedetect types * Global is named `jstz`, not `jstimezonedetect` * Use `export function` syntax rather than exporting an object with properties --- jstimezonedetect/index.d.ts | 14 ++++---------- jstimezonedetect/jstimezonedetect-tests.ts | 2 -- jstimezonedetect/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 jstimezonedetect/tsconfig.json diff --git a/jstimezonedetect/index.d.ts b/jstimezonedetect/index.d.ts index 9709f52724..95295c635e 100644 --- a/jstimezonedetect/index.d.ts +++ b/jstimezonedetect/index.d.ts @@ -1,16 +1,10 @@ -// Type definitions for jsTimezoneDetect +// Type definitions for jsTimezoneDetect 1.0 // Project: https://bitbucket.org/pellepim/jstimezonedetect // Definitions by: Olivier Lamothe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface JsTimezoneDetect { - determine: ()=> { - name: ()=> string; - } +export function determine(): { + name(): string; } -declare var jstimezonedetect: JsTimezoneDetect; - -declare module "jstimezonedetect" { - export = jstimezonedetect; -} +export as namespace jstz; diff --git a/jstimezonedetect/jstimezonedetect-tests.ts b/jstimezonedetect/jstimezonedetect-tests.ts index c4907aa6b0..9baf0f4aa5 100644 --- a/jstimezonedetect/jstimezonedetect-tests.ts +++ b/jstimezonedetect/jstimezonedetect-tests.ts @@ -1,5 +1,3 @@ -/// - import * as jstz from 'jstimezonedetect'; jstz.determine().name() === 'America/Montreal'; diff --git a/jstimezonedetect/tsconfig.json b/jstimezonedetect/tsconfig.json new file mode 100644 index 0000000000..d036a843d1 --- /dev/null +++ b/jstimezonedetect/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jstimezonedetect-tests.ts" + ] +} \ No newline at end of file