Skip to content

Commit

Permalink
typecheck: Fix all remaining errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Jan 21, 2025
1 parent c48cd61 commit 91ef4e1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/libs/blueos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import ky, { HTTPError } from 'ky'
import { useMainVehicleStore } from '@/stores/mainVehicle'
import { ExternalWidgetSetupInfo } from '@/types/widgets'

type BagOfHoldingError = {
/**
* The error message
*/
detail: string
}

/**
* Cockpits extra json format. Taken from extensions in BlueOS and (eventually) other places
*/
Expand Down Expand Up @@ -34,7 +41,7 @@ export const getBagOfHoldingFromVehicle = async (
const options = { timeout: defaultTimeout, retry: 0 }
return await ky.get(`http://${vehicleAddress}/bag/v1.0/get/${bagPath}`, options).json()
} catch (error) {
const errorBody = await (error as HTTPError).response.json()
const errorBody = (await (error as HTTPError).response.json()) as BagOfHoldingError
if (errorBody.detail === 'Invalid path') {
const noPathError = new Error(`No data available in BlueOS storage for path '${bagPath}'.`)
noPathError.name = NoPathInBlueOsErrorName
Expand Down
14 changes: 14 additions & 0 deletions src/libs/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ declare global {
* Extended Window interface with custom dedicated dedicated APIs.
*/
interface Window {
/**
* Extended Performance interface with memory attribute
*/
performance: {
/**
* The memory attribute of the Performance interface returns a MemoryInfo object that provides information about memory usage, including JS heap size limit, total and available JS heap size, and used JS heap size.
*/
memory: {
/**
* The used JS heap size in bytes.
*/
usedJSHeapSize: number
}
}
/**
* Exposed Cockpit APIs
* E.g. data-lake, cockpit actions, etc.
Expand Down
6 changes: 6 additions & 0 deletions src/types/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ declare module 'vue-draggable-resizable' {
const component: DefineComponent<Record<string, never>>
export default component
}

declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<unknown, unknown, any>
export default component
}

0 comments on commit 91ef4e1

Please sign in to comment.