fix(wallet): narrow the bolt11 amount section so the build passes #168

Merged
padreug merged 1 commit from fix/wallet-bolt11-section-narrowing into dev 2026-09-22 21:15:59 +00:00
Owner

dev currently does not build. This is fallout from #162 and should go in before anything is deployed from dev.

src/modules/wallet/services/WalletService.ts(348,31): error TS2339:
  Property 'value' does not exist on type 'Section'.
  Property 'value' does not exist on type '{ name: "checksum"; letters: string; }'.

Section in light-bolt11-decoder is a discriminated union, and its checksum member carries only letters, no value. The predicate was written (s: any) => s.name === 'amount', which is not a type guard, so find returned the whole union and .value could not resolve against every member.

Replaced with a real type predicate that narrows to the amount member.

How I let this through

I verified #162 with vue-tsc --noEmit, but the build script runs vue-tsc -b, which uses the project-reference config and is stricter. The two disagree, so --noEmit passing is not evidence that the build passes. That was the wrong check.

#166 did run a full npm run build:wallet, which is why this looked clean at the time, but that branch was cut from #165 and never contained #162's code. The gap only appeared once all six were merged together.

Verification

Ran the actual build command that failed:

npm run build:wallet  ->  exit 0

Amountless behaviour re-verified after the narrowing, unchanged:

amountless BOLT11 -> 0        amount_msat sent
live 777-sat      -> 777000   amount_msat omitted
malformed         -> null     defer to server
**`dev` currently does not build.** This is fallout from #162 and should go in before anything is deployed from `dev`. ``` src/modules/wallet/services/WalletService.ts(348,31): error TS2339: Property 'value' does not exist on type 'Section'. Property 'value' does not exist on type '{ name: "checksum"; letters: string; }'. ``` `Section` in light-bolt11-decoder is a discriminated union, and its `checksum` member carries only `letters`, no `value`. The predicate was written `(s: any) => s.name === 'amount'`, which is not a type guard, so `find` returned the whole union and `.value` could not resolve against every member. Replaced with a real type predicate that narrows to the `amount` member. ## How I let this through I verified #162 with `vue-tsc --noEmit`, but the build script runs `vue-tsc -b`, which uses the project-reference config and is stricter. The two disagree, so `--noEmit` passing is not evidence that the build passes. That was the wrong check. #166 did run a full `npm run build:wallet`, which is why this looked clean at the time, but that branch was cut from #165 and never contained #162's code. The gap only appeared once all six were merged together. ## Verification Ran the actual build command that failed: ``` npm run build:wallet -> exit 0 ``` Amountless behaviour re-verified after the narrowing, unchanged: ``` amountless BOLT11 -> 0 amount_msat sent live 777-sat -> 777000 amount_msat omitted malformed -> null defer to server ```
`dev` does not build. This is fallout from #162: `vue-tsc -b` rejects
`section.value` with

    error TS2339: Property 'value' does not exist on type 'Section'.
      Property 'value' does not exist on type '{ name: "checksum"; letters: string; }'.

`Section` is a discriminated union and its "checksum" member carries
only `letters`. The predicate was written as `(s: any) => ...`, which is
not a type guard, so `find` returned the whole union and `.value` could
not resolve against every member.

Replaced with a real type predicate narrowing to the `amount` member.

My fault for how I verified #162: I ran `vue-tsc --noEmit`, but the
build script runs `vue-tsc -b`, which uses the project-reference config
and is stricter. The two disagree, so `--noEmit` alone is not evidence
that the build passes. #166 did run a full build, but it was branched
off #165 and so never contained this code.

Amountless behaviour is unchanged, re-verified after the narrowing:
  amountless BOLT11 -> 0        (amount_msat sent)
  live 777-sat       -> 777000  (amount_msat omitted)
  malformed          -> null    (defer to server)

`npm run build:wallet` now succeeds.
padreug deleted branch fix/wallet-bolt11-section-narrowing 2026-09-22 21:15:59 +00:00
Sign in to join this conversation.
No description provided.