Skip to content

Desktop build fails on main (TS2411 in use-slash-completions.ts); failed update also deletes the existing app #39404

@hexorcist404

Description

@hexorcist404

Summary

On Windows, the desktop app build fails on current main due to a TypeScript type error, and — separately but compounding it — a failed update deletes the previously working app without restoring it. The net effect for the user is "the app disappeared after a restart" and "reinstall fails," both from the same root cause.

The type error

apps/desktop/src/app/chat/composer/hooks/use-slash-completions.ts:19

interface SlashItemMetadata extends Record<string, string> {
  command: string
  display: string
  meta: string
  rawText?: string   // string | undefined is not assignable to the `string` index type
}

Because the interface extends Record<string, string>, every property must be string. The optional rawText? widens to string | undefined:

error TS2411: Property 'rawText' of type 'string | undefined' is not assignable to 'string' index type 'string'.
npm error Lifecycle script `build` failed with error: code 1

tsc -b aborts, so npm run build (the desktop stage of the installer/updater) fails. Seen on commit 1eeb7da2e (#39289).

Suggested fix

Make rawText required: rawText: string. This is consistent with the only construction site (use-slash-completions.ts:101 always sets rawText: command) and with the sibling use-at-completions.ts:38, which already declares rawText: string. Verified: with that one-character change, tsc -b exits 0 and the full desktop build (hermes desktop --build-only --force-build) completes and produces a working Hermes.exe.

The compounding reliability bug

When the desktop rebuild fails during an auto-update, electron-builder has already removed the unpacked output before staging:

[before-pack] removed stale unpacked dir before staging: ...\apps\desktop\release\win-unpacked

So the previously working Hermes.exe is gone and the build then fails before producing a replacement. The Start Menu / Desktop shortcuts remain but point at a now-missing file. A failed update should not leave the user with no launchable app — consider building to a temp/staging dir and swapping on success, or keeping the prior win-unpacked until the new build succeeds.

Environment

  • Windows 11 (10.0.26200)
  • Desktop app 0.15.1, electron 40.9.3, electron-builder 26.8.1
  • Reproduces from a clean install and from the in-app auto-update path

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions