From 85c9564f96ec75080fb9885a785488565d83bc24 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 8 Sep 2019 11:27:19 -0700 Subject: [PATCH] Support $ExpectType with || separating multiple choices --- src/rules/expectRule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules/expectRule.ts b/src/rules/expectRule.ts index c79cf2cc..b238dd13 100644 --- a/src/rules/expectRule.ts +++ b/src/rules/expectRule.ts @@ -371,7 +371,7 @@ function getExpectTypeFailures( ? checker.typeToString(type, /*enclosingDeclaration*/ undefined, ts.TypeFormatFlags.NoTruncation) : ""; - if (actual !== expected && !matchReadonlyArray(actual, expected)) { + if (!expected.split(/\s*\|\|\s*/).some(s => actual === s || matchReadonlyArray(actual, s))) { unmetExpectations.push({ node, expected, actual }); }