Fix/ts errors stores - #114
Conversation
maria-jon
commented
Dec 11, 2025
- change StoreProvider type from Component to ParentComponent to remove ts error in app.tsx
- add interface typing StoreParameters to createStore
- add Store type to store const
- fix typing issues with Store type
russbiggs
left a comment
There was a problem hiding this comment.
Avoid any and provide reasoning for ParentComponent
| @@ -1,4 +1,4 @@ | |||
| import { createContext, useContext, Component } from 'solid-js'; | |||
| import { createContext, useContext, ParentComponent } from 'solid-js'; | |||
There was a problem hiding this comment.
Can you provide some context why the ParentComponent type if the right option for this?
There was a problem hiding this comment.
https://docs.solidjs.com/configuration/typescript#components-with-children
Looking at the documentation, ParentComponent seems to be the correct choice since it's a component with children rather than props.
| addRecentMeasurements: () => void; | ||
| updateRecentMeasurements: (parameter: string, measurements) => void; | ||
| setTotalProviders: () => void; | ||
| setRecentMeasurements: (measurements: any) => void; |
There was a problem hiding this comment.
Lets give these more concrete types and avoid any
| setTotalProviders: () => void; | ||
| setRecentMeasurements: (measurements: any) => void; | ||
| addRecentMeasurements: (measurements: any) => void; | ||
| updateRecentMeasurements: (parameter: string, measurements: any) => void; |
There was a problem hiding this comment.
Lets give these more concrete types and avoid any
| updateRecentMeasurements: (parameter: string, measurements) => void; | ||
| setTotalProviders: () => void; | ||
| setRecentMeasurements: (measurements: any) => void; | ||
| addRecentMeasurements: (measurements: any) => void; |
There was a problem hiding this comment.
Lets give these more concrete types and avoid any
| }); | ||
| }, | ||
| setProviders(providers) { | ||
| setProviders(providers: any) { |
There was a problem hiding this comment.
Lets give this a more concrete type and avoid any
| setState({ totalProviders: totalProviders }); | ||
| }, | ||
| setRecentMeasurements(measurements) { | ||
| setRecentMeasurements(measurements: any) { |
There was a problem hiding this comment.
Lets give this a more concrete type and avoid any
| ]); | ||
| }, | ||
| updateRecentMeasurements(parameter: string, measurements) { | ||
| updateRecentMeasurements(parameter: string, measurements: any) { |
There was a problem hiding this comment.
Lets give this a more concrete type and avoid any
| setState({isFlipped: !state.isFlipped }); | ||
| }, | ||
| setGroupLocationsIds(groupLocationsIds) { | ||
| setGroupLocationsIds(groupLocationsIds: any) { |
There was a problem hiding this comment.
Lets give this a more concrete type and avoid any
| setState({ groupLocationsIds: groupLocationsIds }) | ||
| }, | ||
| setGroups(groups) { | ||
| setGroups(groups: any[]) { |
There was a problem hiding this comment.
Lets give this a more concrete type and avoid any