Skip to content

fix(desktop): resolve http/https union type errors in electron main#564

Open
ncw1992120 wants to merge 1 commit into
mateaix:devfrom
ncw1992120:fix/desktop-http-union-typecheck
Open

fix(desktop): resolve http/https union type errors in electron main#564
ncw1992120 wants to merge 1 commit into
mateaix:devfrom
ncw1992120:fix/desktop-http-union-typecheck

Conversation

@ncw1992120

Copy link
Copy Markdown
Contributor

What

Fixes #563 — 5 vue-tsc type errors in mateclaw-desktop/electron/main/index.ts that block npm run build.

Root cause

The backend health-check helper infers a union type:

const client = isHttps ? https : http   // typeof https | typeof http
const req = client.get(...)              // TS2349: not callable on a union

TypeScript won't call .get() on the union (overloads differ), cascading into implicit-any on the res/err callbacks.

Fix

Cast client to typeof http at the call site — https exposes the same callable surface, so runtime is unchanged. Applied to both health-check occurrences (lines ~303 and ~436).

Verification

cd mateclaw-desktop && npx vue-tsc --noEmit

Before: 5 errors. After: 0 errors.

Based on dev (e294b325), no other files touched.

`const client = isHttps ? https : http` produces a `typeof https |
typeof http` union, which TypeScript refuses to call .get() on (TS2349),
cascading into implicit-any errors on the response/error callbacks
(TS7006). Cast to `typeof http` at the call site — https exposes the
same callable surface, so the runtime behavior is unchanged.

Resolves 5 vue-tsc errors in electron/main/index.ts (lines 303, 433, 440).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktop: vue-tsc fails with 5 type errors on http/https union in electron/main/index.ts

1 participant