From 5244040c443a107160de4a827606c8adec8fa68e Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Mon, 13 Mar 2023 12:23:36 +0100 Subject: [PATCH 1/2] Mention Discriminated Unions --- Performance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Performance.md b/Performance.md index 1984fe4a..2b9ec6cb 100644 --- a/Performance.md +++ b/Performance.md @@ -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 base types and [discriminate unions](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#discriminated-unions). ```ts interface Schedule { From 53b344758f6a054cc774198c43e941b8df308f25 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Mon, 13 Mar 2023 12:28:22 +0100 Subject: [PATCH 2/2] Mention base type --- Performance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Performance.md b/Performance.md index 2b9ec6cb..8983bb56 100644 --- a/Performance.md +++ b/Performance.md @@ -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 employ base types and [discriminate unions](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#discriminated-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 {