Skip to content

Commit 1e0fecd

Browse files
committed
fix: type narrowing
1 parent 12c1d45 commit 1e0fecd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/utils/run-command.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ export function getExecutableInfo(
8181

8282
// Object format: keys are command names
8383
const commands = Object.keys(bin)
84-
if (commands.length === 0) {
84+
const firstCommand = commands[0]
85+
if (!firstCommand) {
8586
return { primaryCommand: '', commands: [], hasExecutable: false }
8687
}
8788

8889
// Prefer command matching package name if it exists, otherwise use first
8990
const baseName = packageName.startsWith('@') ? packageName.split('/')[1] : packageName
90-
const primaryCommand = commands.includes(baseName) ? baseName : commands[0]
91+
const primaryCommand = baseName && commands.includes(baseName) ? baseName : firstCommand
9192

9293
return {
9394
primaryCommand,

0 commit comments

Comments
 (0)