You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a break in zustand from looking at the logs of a failed NewErrors run. It might be more correct, but figured it was worth noting.
exporttypeStore<Textendsobject>={setState: (x: T)=>voidgetState: ()=>T;}typeExtractState<S>=Sextends{getState: ()=> infer T} ? T : nevertypeExtractable<SextendsStore<object>>={getServerState?: ()=>ExtractState<S>}exportfunctionf<TStateextendsobject>(api: Extractable<Store<TState>>){// ~~~~~~~~~~~~~// Type 'Store<TState>' does not satisfy the constraint 'Store<object>'.// Types of property 'setState' are incompatible.// Type '(x: TState) => void' is not assignable to type '(x: object) => void'.// Types of parameters 'x' and 'x' are incompatible.// Type 'object' is not assignable to type 'TState'.// 'object' is assignable to the constraint of type 'TState', but 'TState' could be instantiated with a different subtype of constraint 'object'.}
exportfunctionuseStore<TStateextendsState,StateSlice>(api: WithReact<StoreApi<TState>>,// ~~~~~~~~~~~~~~~~// error TS2344: Type 'StoreApi<TState>' does not satisfy the constraint 'StoreApi<object>'.
I found a break in zustand from looking at the logs of a failed NewErrors run. It might be more correct, but figured it was worth noting.
https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/src/react.ts#L30
There's a few of these.
New errors for non-composite project https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tsconfig.json
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/src/react.ts#L30
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/src/react.ts#L56
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/src/react.ts#L59
TS2345 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/src/react.ts#L68
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tests/context.test.tsx#L24
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tests/context.test.tsx#L48
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tests/context.test.tsx#L135
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tests/context.test.tsx#L150
TS2322 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tests/middlewareTypes.test.tsx#L171
TS2344 at https://github.com/pmndrs/zustand/blob/197e5d41993b0e3ad6ebef9a7e6a9161753072f1/tests/types.test.tsx#L86
Originally posted by @DanielRosenwasser in #49488 (comment)