typescript - 泛型创建一个带有字符串和 trype 的对象
问题描述
我怎样才能MinObj
按预期工作{ 'name': string }
?
type MinObj<Key extends string, Type> = { [a: Key]: Type }
type x = MinObj<'name', string>
解决方案
推荐阅读
- capl - 在 Canoe 中使用系统变量切换 dbc(arxml 文件)
- visual-studio - 在构建服务器上使用 MS Visual Studio Community 2017
- google-apps-script - Google API 触发器无法识别其参与者或组织者
- html - 如何防止 div 在调整大小时与另一个 div 重叠?
- c# - .Net Core Worker 中类的依赖注入
- java - 将文件 base64 保存在 blob 列中
- pojo - 如何对 Vapor DB 对象进行单元测试
- c++ - 在单个线程中使用信号量模拟多线程
- python - UTF-16/UTF-32 中的 Python 脚本文件:如何解决 BOM 和 PEP 263 的冲突?
- wpf - ComboBox 条件项颜色