Skip to content

Commit ec299c9

Browse files
committed
refactor: typing improvements
Signed-off-by: Pedro Lamas <[email protected]>
1 parent 1d79dd5 commit ec299c9

File tree

2 files changed

+119
-118
lines changed

2 files changed

+119
-118
lines changed

src/store/printer/getters.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,18 +458,23 @@ export const getters = {
458458
},
459459

460460
getRunoutSensors: (state): RunoutSensor[] => {
461-
const supportedSensors = ['filament_switch_sensor', 'filament_motion_sensor']
461+
const supportedSensors = [
462+
'filament_switch_sensor',
463+
'filament_motion_sensor'
464+
] as const
465+
462466
const sensors: RunoutSensor[] = []
467+
463468
for (const item in state.printer) {
464469
const [type, nameFromSplit] = item.split(' ', 2)
465470

466471
if (supportedSensors.includes(type)) {
467472
const name = nameFromSplit ?? item
468-
const sensor = state.printer[item]
473+
469474
sensors.push({
475+
...state.printer[item],
470476
name,
471477
prettyName: Vue.$filters.prettyCase(name),
472-
...sensor
473478
})
474479
}
475480
}

0 commit comments

Comments
 (0)