MyStore does not satisfy the constraint 'Record<string | number | symbol, unknown>'.
See original GitHub issueThe following code runs fine on 3.0.0
:
import create from 'zustand';
type PlayState = 'playing' | 'paused' | 'stopped';
export interface PlayerStore {
playState: PlayState;
showOutline: boolean;
setPlayState: (state: PlayState) => void;
}
export const usePlayerStore = create<PlayerStore>((set) => ({
playState: 'paused',
showOutline: false,
setPlayState: (playState) => set(() => ({ playState })),
}));
But breaks on 3.1.0
, with the following error message, by tsc:
PlayerStore does not satisfy the constraint 'Record<string | number | symbol, unknown>'.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
MyStore does not satisfy the constraint 'Record<string | number
The following code runs fine on 3.0.0: import create from 'zustand'; type PlayState = 'playing' | 'paused' | 'stopped'; export interface ...
Read more >How to satisfy the constraint of Record<string, unknown> with ...
TS says that MyInterface does not satisfy the constraint Record<string, unknown>. Is there any way around this other than to do
Read more >Incorrect, "Type does not satisfy the constraint" error when ...
However, when R# is enabled it displays, "Type 'string' does not satisfy the constraint 'extends string | number' for type parameter 'TKey'.".
Read more >Why is my Pick<> failing with "Type does not satisfy ... - Reddit
I have a file called ionIcons.ts. It contains a list of var delcarations. export declare var accessibility: string; export declare var…
Read more >Oracle® Text Reference 11g Release 2 (11.2)
Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, here’s the fix using interface. https://codesandbox.io/s/wonderful-bohr-7oqxn
Is it acceptable for your use case?
Sure, it’s not a lot to change 😃