SolidJSS
SolidJSโ€ข3y agoโ€ข
5 replies
Madaxen86

Documentation example of context with typescript does not work

I copied the context example (CounterContext) from the docs to a solid start project. The first error I get is when I pass the store to the Context Provider value: "Type '({ count: any; } | { increment(): void; decrement(): void; })[]' is not assignable to type '({ count: number; } | { count?: undefined; })[]'". Then when I use the useContext example I get the following error "Property 'increment' does not exist on type '{ count: number; } | { count?: undefined; }'" (same for decrement) and when I try to call increment I get "increment is not a function". I am totally confused of how to make an actually simple thing like context (at least in React) work in Solid. Is there a bug or are the docs not up to date or does context not work with solid start (SSR)?
Was this page helpful?