import type { AnyProps, PropsDeclaration } from './define-props.ts' import { createSignal, type Signal } from './signal.ts' /** * A state is simply a collection of signals. */ export type State = { [Key in keyof Props]: Signal } /** * @internal */ export function createState( propsDeclaration: PropsDeclaration, ): State { const store: Record> = {} for (const key of Object.keys(propsDeclaration)) { const declaration = propsDeclaration[key] const signal = createSignal(declaration.default) store[key] = signal } return store as State }