Skip to content

Enable exactOptionalPropertyTypes; widen optional props that accept undefined#61

Merged
lwwmanning merged 1 commit intomainfrom
claude/exact-optional-property-types
May 4, 2026
Merged

Enable exactOptionalPropertyTypes; widen optional props that accept undefined#61
lwwmanning merged 1 commit intomainfrom
claude/exact-optional-property-types

Conversation

@lwwmanning
Copy link
Copy Markdown
Contributor

Summary

Turns on TypeScript's exactOptionalPropertyTypes, which distinguishes between:

  • prop?: T — can be omitted entirely (callers must omit, not pass explicit undefined)
  • prop?: T | undefined — optional and explicitly accepts undefined

Three call sites trip on this, all with the same shape: a value that's genuinely T | undefined at the source (frontmatter excerpt, optional check message) being passed into a prop?: T slot. The renderer/consumer in each case already handles undefined with a truthiness check, so the natural intent is "optional in either form" — widen the signature to prop?: T | undefined rather than reshape the call sites with conditional spreads.

Type widenings:

  • scripts/verify.tsCheckResult.msg: ?: string?: string | undefined
  • src/lib/og.tsxrenderOgImage params: description and eyebrow widened on both the public function signature and the internal OgCard component

No behavioral change. The OG card still renders the description / eyebrow only when truthy; verify.ts's failure messages still serialize as before. The flag flip is the substantive change; the type tweaks are scaffolding to keep tsc happy.

Test plan

  • CI green (lint, build, typecheck, verify, audit, dependency-review)
  • Vercel preview: /blog/<slug>/opengraph-image renders correctly for posts with and without an excerpt (eyeball both — pick a post with an excerpt frontmatter field and one without)
  • bun run verify against the preview surfaces failure messages cleanly when intentionally broken (regression check on verify.ts CheckResult plumbing)

🤖 Generated with Claude Code

…ndefined

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Will Manning <will@willmanning.io>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vortex Ready Ready Preview, Comment May 4, 2026 6:54pm

Request Review

@lwwmanning lwwmanning enabled auto-merge (squash) May 4, 2026 18:55
@lwwmanning lwwmanning merged commit ce26d52 into main May 4, 2026
5 checks passed
@lwwmanning lwwmanning deleted the claude/exact-optional-property-types branch May 4, 2026 18:55
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