Enable exactOptionalPropertyTypes; widen optional props that accept undefined#61
Merged
lwwmanning merged 1 commit intomainfrom May 4, 2026
Merged
Conversation
…ndefined Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Will Manning <will@willmanning.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Turns on TypeScript's
exactOptionalPropertyTypes, which distinguishes between:prop?: T— can be omitted entirely (callers must omit, not pass explicitundefined)prop?: T | undefined— optional and explicitly acceptsundefinedThree call sites trip on this, all with the same shape: a value that's genuinely
T | undefinedat the source (frontmatter excerpt, optional check message) being passed into aprop?: Tslot. 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 toprop?: T | undefinedrather than reshape the call sites with conditional spreads.Type widenings:
scripts/verify.ts—CheckResult.msg:?: string→?: string | undefinedsrc/lib/og.tsx—renderOgImageparams:descriptionandeyebrowwidened on both the public function signature and the internalOgCardcomponentNo 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
/blog/<slug>/opengraph-imagerenders correctly for posts with and without an excerpt (eyeball both — pick a post with anexcerptfrontmatter field and one without)bun run verifyagainst the preview surfaces failure messages cleanly when intentionally broken (regression check on verify.ts CheckResult plumbing)🤖 Generated with Claude Code