Skip to content

Commit

Permalink
refactor: handle missing data in conflicts fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Nov 21, 2023
1 parent 8e0e4f4 commit db44619
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/conflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
import { ux } from '@oclif/core';
import { ConflictResponse } from '@salesforce/source-tracking';

export const writeConflictTable = (conflicts: ConflictResponse[]): void => {
export const writeConflictTable = (conflicts?: ConflictResponse[]): void => {
// Interfaces cannot be casted to Record<string, unknown> so we have to cast to unknown first
// See https://github.com/microsoft/TypeScript/issues/15300
if (!conflicts || conflicts.length === 0) {
return;
}
ux.table(
conflicts.map((c) => ({ state: c.state, fullName: c.fullName, type: c.type, filePath: c.filePath })),
{
Expand Down

0 comments on commit db44619

Please sign in to comment.