Documentation make no sense. (Typescript)
See original GitHub issueFollowed this: https://easy-peasy.vercel.app/docs/tutorials/typescript.html
then end-up like this
interface Todo {
text: string;
done: boolean;
}
interface StoreModel {
todos: Todo[];
}
interface TodosModel {
todos: Todo[];
completedTodos: Computed<TodosModel, Todo[]>;
addTodo: Action<TodosModel, Todo>;
saveTodo: Thunk<TodosModel, Todo>;
}
const store = createStore<StoreModel>({
todos: [],
completedTodos: computed((state) => state.todos.filter((todo) => todo.done)),
addTodo: action((state, payload) => {
state.todos.push(payload);
}),
saveTodo: thunk(async (actions, payload) => {
const result = await axios.post('/todos', payload);
actions.addTodo(result.data);
}),
});
export default store;
which look like this https://prnt.sc/C-FuQtxZDvpU then: https://prnt.sc/ZO6_XK27F_D-
I still can’t figure out what is the issue. I see one issue is the documentation.
** "easy-peasy": "^5.0.4" "typescript": "^4.6.4" on PHPStorm 2022.1
Issue Analytics
- State:
- Created a year ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
The starting point for learning TypeScript
Popular Documentation Pages. Everyday Types. All of the common types in TypeScript. Creating Types from Types. Techniques to make more elegant types.
Read more >Documenting Your TypeScript Projects: There Are Options
Whether you're a TypeScript developer, a JavaScript developer or any type of ... just make sure you don't pick the third hidden option:...
Read more >Docs: Extend a documentation on how casting works ... - GitHub
Which does not make any sense, it does nothing and makes weird bugs during runtime. It's the same here: let foo: string =...
Read more >Troubleshooting Issues with the TypeScript SDK
This document is a quick checklist of common user errors for your reference. ... You may get errors that make no sense to...
Read more >JSON.stringify() - JavaScript - MDN Web Docs
(But unlike the values in the previous point, they would never be omitted ... are not enumerable and make no sense in JSON...
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 Free
Top 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

Correct 👍
Oh I see 😅 sorry for the confusion.
Any help is appreciated 👏
That would be awesome. Take a look at #773 if you need inspiration or a project template.
Nice @no-stack-dub-sack ! Your examples look really neat 👍 I think this setup would work great, especially for big slices/stores.
We use multiple slices (we call them nested stores/sub-stores), even up to 3-4 levels deep. Our slices are primarily in a single file - as the slices themselves aren’t that big.
Because of our usecase, we treat models for each section a bit like “css modules” - we want them to live along side the component. So typically we have a
Component.tsxand aComponent.model.tsfor the store model related to the component. This basically means that our file structure basically mirrors our state object.All these component models are then nested into slices and referenced in our main
model.ts.That’s the gist of it. It’s a bit tricky to exemplify, but I’ll think of some way to make an example of this when I got some spare time.