diff --git a/lib/models/os.ts b/lib/models/os.ts index a963db235..1b772e05b 100644 --- a/lib/models/os.ts +++ b/lib/models/os.ts @@ -472,7 +472,7 @@ const getOsModel = function ( url: `/device-types/v1/${deviceType}/images/${version}/download-size`, baseUrl: apiUrl, }); - return body.size; + return body.size as number; }, ); @@ -937,8 +937,14 @@ const getOsModel = function ( }; return { - _getNormalizedDeviceTypeSlug, - _getDownloadSize, + // Cast the exported types for internal methods so `@types/memoizee` can be a dev depenency. + _getNormalizedDeviceTypeSlug: _getNormalizedDeviceTypeSlug as ( + deviceTypeSlug: string, + ) => Promise, + _getDownloadSize: _getDownloadSize as ( + deviceType: string, + version: string, + ) => Promise, _clearDeviceTypesAndOsVersionCaches, _getMaxSatisfyingVersion, OsTypes, diff --git a/package.json b/package.json index 7b329d546..414a97bc3 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,8 @@ "@balena/lint": "^6.1.1", "@types/chai": "^4.3.0", "@types/chai-as-promised": "^7.1.4", + "@types/lodash": "^4.14.182", + "@types/memoizee": "^0.4.7", "@types/mocha": "^5.2.7", "@types/ndjson": "^2.0.0", "@types/sinon": "^10.0.6", @@ -103,8 +105,6 @@ "dependencies": { "@balena/es-version": "^1.0.0", "@types/json-schema": "^7.0.9", - "@types/lodash": "^4.14.168", - "@types/memoizee": "^0.4.5", "@types/node": "^10.17.55", "abortcontroller-polyfill": "^1.7.1", "balena-auth": "^4.1.0",