Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention Discriminated Unions #308

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ For a two-element union, this is trivial and inexpensive.
However, if your union has more than a dozen elements, it can cause real problems in compilation speed.
For instance, to eliminate redundant members from a union, the elements have to be compared pairwise, which is quadratic.
This sort of check might occur when intersecting large unions, where intersecting over each union member can result in enormous types that then need to be reduced.
One way to avoid this is to use subtypes, rather than unions.
One way to avoid this is to employ a base type (`Schedule`) and [discriminate unions](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#discriminated-unions).

```ts
interface Schedule {
Expand Down