Skip to content

Commit 9c41599

Browse files
feat(ui): add guardrails to prevent entity types being missed in useIsEntityTypeEnabled
1 parent dbb5830 commit 9c41599

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

invokeai/frontend/web/src/features/controlLayers/hooks/useIsEntityTypeEnabled.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { useAppSelector } from 'app/store/storeHooks';
22
import { selectIsCogView4, selectIsSD3 } from 'features/controlLayers/store/paramsSlice';
33
import type { CanvasEntityType } from 'features/controlLayers/store/types';
44
import { useMemo } from 'react';
5+
import type { Equals } from 'tsafe';
6+
import { assert } from 'tsafe';
57

68
export const useIsEntityTypeEnabled = (entityType: CanvasEntityType) => {
79
const isSD3 = useAppSelector(selectIsSD3);
@@ -20,7 +22,7 @@ export const useIsEntityTypeEnabled = (entityType: CanvasEntityType) => {
2022
case 'raster_layer':
2123
return true;
2224
default:
23-
break;
25+
assert<Equals<typeof entityType, never>>(false);
2426
}
2527
}, [entityType, isSD3, isCogView4]);
2628

0 commit comments

Comments
 (0)