Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #250 from microsoft/multipleExpectTypes
Browse files Browse the repository at this point in the history
Support $ExpectType with || separating multiple choices
  • Loading branch information
ahejlsberg authored Sep 12, 2019
2 parents 18e1c00 + 85c9564 commit a83452a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/expectRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand Down

0 comments on commit a83452a

Please sign in to comment.