javascript - 使用 Redux 存储进行流类型检查是如何工作的?
问题描述
我见过这样的代码:
import type { Store as ReduxStore } from 'redux';
export type Store = ReduxStore<State, Action>;
我不明白<State, Action>
在做什么。是否将类型参数传递给 ReduxStore?
解决方案
是的,它们是类型参数。
export type Store = ReduxStore<State, Action>;
这表示类型Store
是一种ReduxStore
在任何特定时刻都具有类型状态的类型State
,并且它减少了类型的过度动作Action
。
推荐阅读
- html - 如何裁剪在块外爬行的内容?
- python - 使用python中的类ID在模态对话框中抓取Facebook Market
- java - Angular ng-swagger-gen 从一台服务器的许多资源生成
- visual-studio - Visual Studio 配置目录自动更改
- python - Pandas DataFrame:如何创建多列索引
- java - 有没有办法监控在 android studio 中使用 web 视图播放的视频的进度
- string - 如何在 Kotlin 中使用“.”将一个字符串拆分为两个字符串?
- python - Python 条件替换
- html - 悬停时 CSS 边框宽度更改无法按预期工作
- javascript - 如何从 html 表中更新和删除 firebase 数据