diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 13cfc91..6a509a1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -8,9 +8,9 @@ import { LevelName } from './components/NotificationsComponent'; import { ConnectionToast } from './components/ConnectionToast'; -import { SerializedValue, setNestedValueByPath, State } from './utils/stateUtils'; +import { setNestedValueByPath, State } from './utils/stateUtils'; import { WebSettingsContext, WebSetting } from './WebSettings'; -import { Attribute, GenericComponent } from './components/GenericComponent'; +import { SerializedValue, GenericComponent } from './components/GenericComponent'; type Action = | { type: 'SET_DATA'; data: State } @@ -187,7 +187,7 @@ const App = () => { diff --git a/frontend/src/components/GenericComponent.tsx b/frontend/src/components/GenericComponent.tsx index cd40029..9149301 100644 --- a/frontend/src/components/GenericComponent.tsx +++ b/frontend/src/components/GenericComponent.tsx @@ -28,8 +28,8 @@ type AttributeType = | 'Image' | 'ColouredEnum'; -type ValueType = boolean | string | number | object; -export type Attribute = { +type ValueType = boolean | string | number | Record; +export type SerializedValue = { type: AttributeType; value?: ValueType | ValueType[]; readonly: boolean; @@ -39,7 +39,7 @@ export type Attribute = { enum?: Record; }; type GenericComponentProps = { - attribute: Attribute; + attribute: SerializedValue; name: string; parentPath: string; isInstantUpdate: boolean; @@ -177,7 +177,7 @@ export const GenericComponent = React.memo( return ( ; + parameters: Record; docString?: string; hideOutput?: boolean; addNotification: (message: string, levelname?: LevelName) => void; diff --git a/frontend/src/utils/stateUtils.ts b/frontend/src/utils/stateUtils.ts index 474daea..a9f3cf3 100644 --- a/frontend/src/utils/stateUtils.ts +++ b/frontend/src/utils/stateUtils.ts @@ -1,11 +1,5 @@ -export interface SerializedValue { - type: string; - value: Record | Array>; - readonly: boolean; - doc: string | null; - async?: boolean; - parameters?: unknown; -} +import { SerializedValue } from '../components/GenericComponent'; + export type State = { type: string; value: Record | null;