diff --git a/src/libs/actions/Device/generateDeviceID/index.android.js b/src/libs/actions/Device/generateDeviceID/index.android.ts similarity index 92% rename from src/libs/actions/Device/generateDeviceID/index.android.js rename to src/libs/actions/Device/generateDeviceID/index.android.ts index f61b860bda7d..0f6a7140e648 100644 --- a/src/libs/actions/Device/generateDeviceID/index.android.js +++ b/src/libs/actions/Device/generateDeviceID/index.android.ts @@ -1,5 +1,6 @@ import DeviceInfo from 'react-native-device-info'; import Str from 'expensify-common/lib/str'; +import GenerateDeviceID from './types'; const deviceID = DeviceInfo.getDeviceId(); const uniqueID = Str.guid(deviceID); @@ -22,11 +23,7 @@ const uniqueID = Str.guid(deviceID); * * Furthermore, the deviceID prefix is not unique to a specific device, but is likely to change from one type of device to another. * Including this prefix will tell us with a reasonable degree of confidence if the user just uninstalled and reinstalled the app, or if they got a new device. - * - * @returns {Promise} */ -function generateDeviceID() { - return Promise.resolve(uniqueID); -} +const generateDeviceID: GenerateDeviceID = () => Promise.resolve(uniqueID); export default generateDeviceID; diff --git a/src/libs/actions/Device/generateDeviceID/index.desktop.js b/src/libs/actions/Device/generateDeviceID/index.desktop.ts similarity index 61% rename from src/libs/actions/Device/generateDeviceID/index.desktop.js rename to src/libs/actions/Device/generateDeviceID/index.desktop.ts index 26de25e326e8..04a291c5b3bb 100644 --- a/src/libs/actions/Device/generateDeviceID/index.desktop.js +++ b/src/libs/actions/Device/generateDeviceID/index.desktop.ts @@ -1,12 +1,9 @@ import ELECTRON_EVENTS from '../../../../../desktop/ELECTRON_EVENTS'; +import GenerateDeviceID from './types'; /** * Get the unique ID of the current device. This should remain the same even if the user uninstalls and reinstalls the app. - * - * @returns {Promise} */ -function generateDeviceID() { - return window.electron.invoke(ELECTRON_EVENTS.REQUEST_DEVICE_ID); -} +const generateDeviceID: GenerateDeviceID = () => window.electron.invoke(ELECTRON_EVENTS.REQUEST_DEVICE_ID); export default generateDeviceID; diff --git a/src/libs/actions/Device/generateDeviceID/index.ios.js b/src/libs/actions/Device/generateDeviceID/index.ios.ts similarity index 61% rename from src/libs/actions/Device/generateDeviceID/index.ios.js rename to src/libs/actions/Device/generateDeviceID/index.ios.ts index 6836edf1fcee..9562fc8bbf9b 100644 --- a/src/libs/actions/Device/generateDeviceID/index.ios.js +++ b/src/libs/actions/Device/generateDeviceID/index.ios.ts @@ -1,14 +1,11 @@ import DeviceInfo from 'react-native-device-info'; +import GenerateDeviceID from './types'; const deviceID = DeviceInfo.getDeviceId(); /** * Get the unique ID of the current device. This should remain the same even if the user uninstalls and reinstalls the app. - * - * @returns {Promise} */ -function generateDeviceID() { - return DeviceInfo.getUniqueId().then((uniqueID) => `${deviceID}_${uniqueID}`); -} +const generateDeviceID: GenerateDeviceID = () => DeviceInfo.getUniqueId().then((uniqueID) => `${deviceID}_${uniqueID}`); export default generateDeviceID; diff --git a/src/libs/actions/Device/generateDeviceID/index.website.js b/src/libs/actions/Device/generateDeviceID/index.ts similarity index 87% rename from src/libs/actions/Device/generateDeviceID/index.website.js rename to src/libs/actions/Device/generateDeviceID/index.ts index b8abc4734134..cc631547e750 100644 --- a/src/libs/actions/Device/generateDeviceID/index.website.js +++ b/src/libs/actions/Device/generateDeviceID/index.ts @@ -1,4 +1,5 @@ import Str from 'expensify-common/lib/str'; +import GenerateDeviceID from './types'; const uniqueID = Str.guid(); @@ -13,11 +14,7 @@ const uniqueID = Str.guid(); * * While this isn't perfect, it's just as good as any other obvious web solution, such as this one https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId * which is also different/reset under the same circumstances - * - * @returns {Promise} */ -function generateDeviceID() { - return Promise.resolve(uniqueID); -} +const generateDeviceID: GenerateDeviceID = () => Promise.resolve(uniqueID); export default generateDeviceID; diff --git a/src/libs/actions/Device/generateDeviceID/types.ts b/src/libs/actions/Device/generateDeviceID/types.ts new file mode 100644 index 000000000000..43b6b89f6154 --- /dev/null +++ b/src/libs/actions/Device/generateDeviceID/types.ts @@ -0,0 +1,3 @@ +type GenerateDeviceID = () => Promise; + +export default GenerateDeviceID;