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

Commit

Permalink
Support $ExpectType with || separating multiple choices
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Sep 8, 2019
1 parent 4aba6b9 commit 85c9564
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 85c9564

Please sign in to comment.