Skip to content

Commit

Permalink
Clarify exhaustiveCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jun 7, 2024
1 parent fc3c525 commit 7f7c776
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
19 changes: 12 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32416,13 +32416,18 @@ function matchPath({ workflowFile, jobName, jobMatchMode }, summary) {
if (!jobName) {
return true;
}
if (jobMatchMode === "exact") {
return jobName === summary.jobName;
}
if (jobMatchMode === "prefix") {
return summary.jobName.startsWith(jobName);
switch (jobMatchMode) {
case "exact": {
return jobName === summary.jobName;
}
case "prefix": {
return summary.jobName.startsWith(jobName);
}
default: {
const _exhaustiveCheck = jobMatchMode;
return false;
}
}
return false;
}
function seekWaitList(summaries, waitList, elapsed) {
const seeker = waitList.map((condition) => ({ ...condition, found: false }));
Expand Down Expand Up @@ -32579,7 +32584,7 @@ function colorize(severity, message) {
return message;
}
default: {
const _unexpectedSeverity = severity;
const _exhaustiveCheck = severity;
return message;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function colorize(severity: Severity, message: string): string {
return message;
}
default: {
const _unexpectedSeverity: never = severity;
const _exhaustiveCheck: never = severity;
return message;
}
}
Expand Down
19 changes: 11 additions & 8 deletions src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ function matchPath({ workflowFile, jobName, jobMatchMode }: FilterCondition, sum
return true;
}

if (jobMatchMode === 'exact') {
return jobName === summary.jobName;
}

if (jobMatchMode === 'prefix') {
return summary.jobName.startsWith(jobName);
switch (jobMatchMode) {
case 'exact': {
return jobName === summary.jobName;
}
case 'prefix': {
return summary.jobName.startsWith(jobName);
}
default: {
const _exhaustiveCheck: never = jobMatchMode;
return false;
}
}

return false;
}

function seekWaitList(
Expand Down

0 comments on commit 7f7c776

Please sign in to comment.