TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Programming with union, intersection, and negation types

35 点作者 pbowyer将近 3 年前

2 条评论

quickthrower2将近 3 年前
Not sure about negation, but humble Typescript lets you use union and intersection types.<p>I am hooked on intersection types in Typescript. It is like mixin heaven.<p>I have a WithId type I use alot that I can tack on to any Firebase record type.<p>If I had the motivation I could write a generic firebase getter that returns documents as a “T &amp; WithId” (means type T with an additional id:string field)<p>It decreases the number of types you need to define for one. And lets you lego up various interfaces.
评论 #32019757 未加载
评论 #32019854 未加载
galaxyLogic将近 3 年前
Isn&#x27;t Union Types just the same as &quot;Sum Types&quot; (as in Haskell etc.)?<p>But does Haskell have Intersection Types and Negation Types?
评论 #32018960 未加载
评论 #32018972 未加载