百科
.dev
全部条目
趋势榜
开源项目
技术资讯
提交条目
Language
中文
English
登录
< 返回工具列表
Language
中文
English
T
ts-pattern
> 编程语言
开源
TypeScript的详尽模式匹配库,带有智能类型的推论.
15.1K stars
0 点赞
0 次浏览
访问官网
GitHub
点赞
收藏
分享体验
工具介绍
TypeScript的详尽模式匹配库,带有智能类型的推论.
,与({{}类型:'ok',数据:{{}类型:`text'}}},(res)=,与({{}类型:'ok',数据:{类型:'img',src:P.selection ()}}},(src)==. explect ();关于写作更好、更安全的条件。 父亲..
核心特点
•
Pattern-match on any data structure: nested Objects, Arrays, Tuples, Sets, Maps and all primitive types.
•
Typesafe, with helpful type inference.
•
Exhaustiveness checking support, enforcing that you are matching every possible case with .exhaustive().
•
Use patterns to validate the shape of your data with isMatching.
•
Expressive API, with catch-all and type specific wildcards: P._, P.string, P.number, etc.
•
Supports predicates, unions, intersections and exclusion patterns for non-trivial cases.
•
Supports properties selection, via the P.select(name?) function.
•
Tiny bundle footprint (only ~2kB).
•
Sandbox examples
•
Getting Started
>
标签
TypeScript
branching
conditions
exhaustive
inference
>
讨论区
最新
发表
暂无评论,来聊聊你的看法吧
> 工具信息
发布日期
2026年8月1日
最后更新
2026年9月9日
分类
编程语言
定价
开源
> 相关工具
T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言
报告问题