[Typescript] Recursion Type
Recursive types, are self-referential, and are often used to describe infinitely nestable types. For example, consider infinitely nestable arrays of numbers
[3, 4, [5, 6, [7], 59], 221]
You may read or see things that indicate you must use a combination of interface
and type
for recursive types. As of TypeScript 3.7 this is now much easier, and works with either type aliases or interfaces.
type NestedNumbers = number | NestedNumbers[]
const val: NestedNumbers = [3, 4, [5, 6, [7], 59], 221]
分类:
TypeScript
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2020-07-27 [Express 5] Create a express 5 application with node 14
2020-07-27 [Bash] Batch Rename Every File in a Directory with zsh
2020-07-27 [Angular] Angular Router Extra Options - Recommended Settings
2020-07-27 [CSS 3 + JS] Create a Function to Convert JS Numbers into CSS Hex Colors
2020-07-27 [Express] Handle Syncronous and Asyncronous Errors in Express
2019-07-27 [RxJava] Mapping
2018-07-27 [JavaEE] JTA, Java Transaction API, Repository for DB opreations