From 5a7eb1cbc89b8d850b4bc57a4dd72ca1109cc03b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 28 Apr 2018 08:24:41 -0700 Subject: [PATCH] Fix typo --- src/compiler/checker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f0cbd70ed9c..22c8add26de 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8250,7 +8250,7 @@ namespace ts { return includes; } - function removeRedundantPrimtiveTypes(types: Type[], includes: TypeFlags) { + function removeRedundantPrimitiveTypes(types: Type[], includes: TypeFlags) { let i = types.length; while (i > 0) { i--; @@ -8264,6 +8264,7 @@ namespace ts { } } } + // We normalize combinations of intersection and union types based on the distributive property of the '&' // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection // types with union type constituents into equivalent union types with intersection type constituents and @@ -8289,7 +8290,7 @@ namespace ts { if (includes & TypeFlags.String && includes & TypeFlags.StringLiteral || includes & TypeFlags.Number && includes & TypeFlags.NumberLiteral || includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) { - removeRedundantPrimtiveTypes(typeSet, includes); + removeRedundantPrimitiveTypes(typeSet, includes); } if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object)) { typeSet.push(emptyObjectType);