From 066241d3fdc6c38af9138839720d57d2d4d83d74 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 23 Aug 2023 09:46:16 +0200 Subject: [PATCH] [TS migration] Migrate 'getPlatform' constants dependency to TypeScript --- src/libs/getPlatform/index.android.js | 5 ----- src/libs/getPlatform/index.android.ts | 6 ++++++ src/libs/getPlatform/index.desktop.js | 5 ----- src/libs/getPlatform/index.desktop.ts | 6 ++++++ src/libs/getPlatform/index.ios.js | 5 ----- src/libs/getPlatform/index.ios.ts | 6 ++++++ src/libs/getPlatform/index.ts | 6 ++++++ src/libs/getPlatform/index.website.js | 5 ----- src/libs/getPlatform/types.ts | 6 ++++++ 9 files changed, 30 insertions(+), 20 deletions(-) delete mode 100644 src/libs/getPlatform/index.android.js create mode 100644 src/libs/getPlatform/index.android.ts delete mode 100644 src/libs/getPlatform/index.desktop.js create mode 100644 src/libs/getPlatform/index.desktop.ts delete mode 100644 src/libs/getPlatform/index.ios.js create mode 100644 src/libs/getPlatform/index.ios.ts create mode 100644 src/libs/getPlatform/index.ts delete mode 100644 src/libs/getPlatform/index.website.js create mode 100644 src/libs/getPlatform/types.ts diff --git a/src/libs/getPlatform/index.android.js b/src/libs/getPlatform/index.android.js deleted file mode 100644 index 1a343700a2f9..000000000000 --- a/src/libs/getPlatform/index.android.js +++ /dev/null @@ -1,5 +0,0 @@ -import CONST from '../../CONST'; - -export default function getPlatform() { - return CONST.PLATFORM.ANDROID; -} diff --git a/src/libs/getPlatform/index.android.ts b/src/libs/getPlatform/index.android.ts new file mode 100644 index 000000000000..14ed65ace19d --- /dev/null +++ b/src/libs/getPlatform/index.android.ts @@ -0,0 +1,6 @@ +import CONST from '../../CONST'; +import Platform from './types'; + +export default function getPlatform(): Platform { + return CONST.PLATFORM.ANDROID; +} diff --git a/src/libs/getPlatform/index.desktop.js b/src/libs/getPlatform/index.desktop.js deleted file mode 100644 index c00ea00fd645..000000000000 --- a/src/libs/getPlatform/index.desktop.js +++ /dev/null @@ -1,5 +0,0 @@ -import CONST from '../../CONST'; - -export default function getPlatform() { - return CONST.PLATFORM.DESKTOP; -} diff --git a/src/libs/getPlatform/index.desktop.ts b/src/libs/getPlatform/index.desktop.ts new file mode 100644 index 000000000000..c9f5720c541d --- /dev/null +++ b/src/libs/getPlatform/index.desktop.ts @@ -0,0 +1,6 @@ +import CONST from '../../CONST'; +import Platform from './types'; + +export default function getPlatform(): Platform { + return CONST.PLATFORM.DESKTOP; +} diff --git a/src/libs/getPlatform/index.ios.js b/src/libs/getPlatform/index.ios.js deleted file mode 100644 index d91604a5c41a..000000000000 --- a/src/libs/getPlatform/index.ios.js +++ /dev/null @@ -1,5 +0,0 @@ -import CONST from '../../CONST'; - -export default function getPlatform() { - return CONST.PLATFORM.IOS; -} diff --git a/src/libs/getPlatform/index.ios.ts b/src/libs/getPlatform/index.ios.ts new file mode 100644 index 000000000000..8c21189b92e7 --- /dev/null +++ b/src/libs/getPlatform/index.ios.ts @@ -0,0 +1,6 @@ +import CONST from '../../CONST'; +import Platform from './types'; + +export default function getPlatform(): Platform { + return CONST.PLATFORM.IOS; +} diff --git a/src/libs/getPlatform/index.ts b/src/libs/getPlatform/index.ts new file mode 100644 index 000000000000..c53963f5b80f --- /dev/null +++ b/src/libs/getPlatform/index.ts @@ -0,0 +1,6 @@ +import CONST from '../../CONST'; +import Platform from './types'; + +export default function getPlatform(): Platform { + return CONST.PLATFORM.WEB; +} diff --git a/src/libs/getPlatform/index.website.js b/src/libs/getPlatform/index.website.js deleted file mode 100644 index 8b7e99c13c10..000000000000 --- a/src/libs/getPlatform/index.website.js +++ /dev/null @@ -1,5 +0,0 @@ -import CONST from '../../CONST'; - -export default function getPlatform() { - return CONST.PLATFORM.WEB; -} diff --git a/src/libs/getPlatform/types.ts b/src/libs/getPlatform/types.ts new file mode 100644 index 000000000000..ceddb4e17224 --- /dev/null +++ b/src/libs/getPlatform/types.ts @@ -0,0 +1,6 @@ +import {ValueOf} from 'type-fest'; +import CONST from '../../CONST'; + +type Platform = ValueOf; + +export default Platform;