We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
注意📌列,推导出的 type 不是 ActionTodoConstants,而是精确类型 ActionTodoConstants.ADD_TODO,没有必要手动写类型声明,只需纠正默认推导的方式即可
ActionTodoConstants.ADD_TODO
// constants/todo.ts export enum ActionTodoConstants { ADD_TODO = 'todo/add', TOGGLE_TODO = 'todo/toggle', } // actions/todo.ts let id = 0 const addTodo = (name: string) => ({ payload: { todo: { done: false, id: id++, name, }, }, type: ActionTodoConstants.ADD_TODO as const,// 📌 })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
注意📌列,推导出的 type 不是 ActionTodoConstants,而是精确类型
ActionTodoConstants.ADD_TODO
,没有必要手动写类型声明,只需纠正默认推导的方式即可The text was updated successfully, but these errors were encountered: