Skip to content

[BY-3684]: type HttpError.status as number | undefined - #51

Merged
svargas-dev merged 1 commit into
masterfrom
feature/by-3684
Oct 8, 2026
Merged

svargas-dev merged 1 commit into
masterfrom
feature/by-3684

Conversation

@svargas-dev

Copy link
Copy Markdown
Contributor

Summary

HttpError.status is absent when the request never got a response, but the generated dist/index.d.ts declared it as number (tsconfig runs with strict: false, so the optional constructor param collapses to number in emitted types).

Consumers (e.g. the marketing app's surfaceError default handler) rely on a fallback chain e.status ?? e.body?.statusCode ?? 500 that only makes sense if status can genuinely be undefined.

Change

  • Annotate this.status as @type {number | undefined} in lib/index.js
  • Generated d.ts now emits status: number | undefined

Validation

  • pnpm build: d.ts verified
  • pnpm test: 74 passing
  • eslint lib/index.js: clean

Refs BY-3684

status is absent when the request never got a response, but the generated d.ts declared number. Consumers surface the error via e.status ?? e.body?.statusCode ?? 500 and need the type to reflect that.
@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@beyonk/http@51

commit: 3a4b341

@svargas-dev
svargas-dev merged commit 468ee16 into master Oct 8, 2026
3 checks passed
@paulambanks
paulambanks deleted the feature/by-3684 branch October 9, 2026 12:29
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.

1 participant