From f542c03c07ae3c6254fe5bca121036c7553f352f Mon Sep 17 00:00:00 2001 From: Gary Hunt Date: Mon, 14 Mar 2022 07:41:11 +0000 Subject: [PATCH] feat(ts) convert service/statistics/constants to typescript --- service/statistics/constants.js | 5 ----- service/statistics/constants.spec.ts | 6 +----- service/statistics/constants.ts | 1 + types/auto/service/statistics/constants.d.ts | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 service/statistics/constants.js create mode 100644 service/statistics/constants.ts diff --git a/service/statistics/constants.js b/service/statistics/constants.js deleted file mode 100644 index 09853251c9..0000000000 --- a/service/statistics/constants.js +++ /dev/null @@ -1,5 +0,0 @@ -const Constants = { - LOCAL_JID: 'local' -}; - -module.exports = Constants; diff --git a/service/statistics/constants.spec.ts b/service/statistics/constants.spec.ts index d4f7be1c36..7191c2e870 100644 --- a/service/statistics/constants.spec.ts +++ b/service/statistics/constants.spec.ts @@ -5,15 +5,11 @@ import * as exported from "./constants"; describe( "/service/statistics/constants members", () => { const { LOCAL_JID, - Constants, ...others - } = exported as any; // TODO: remove cast after typescript conversion + } = exported; it( "known members", () => { expect( LOCAL_JID ).toBe( 'local' ); - if ( Constants ) { - expect( Constants.LOCAL_JID ).toBe( 'local' ); - } } ); it( "unknown members", () => { diff --git a/service/statistics/constants.ts b/service/statistics/constants.ts new file mode 100644 index 0000000000..9778f7b723 --- /dev/null +++ b/service/statistics/constants.ts @@ -0,0 +1 @@ +export const LOCAL_JID = 'local' diff --git a/types/auto/service/statistics/constants.d.ts b/types/auto/service/statistics/constants.d.ts index af32dbd4fd..9890c2010c 100644 --- a/types/auto/service/statistics/constants.d.ts +++ b/types/auto/service/statistics/constants.d.ts @@ -1 +1 @@ -export const LOCAL_JID: string; +export declare const LOCAL_JID = "local";