Skip to content

docs: type webContents as nullable in app 'login' and 'select-client-certificate' - #53202

Merged
MarshallOfSound merged 1 commit into
mainfrom
docs-nullable-webcontents-events
Aug 28, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
docs-nullable-webcontents-events

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

app's login and select-client-certificate events fire with webContents === null for requests that don't originate from a renderer (net.fetch/net.request, utility processes; #52162 added the latter case for select-client-certificate in 44). The prose and breaking-changes.md say so, but the parameter lines were marked (optional), which the definitions generator drops for a non-trailing event argument, so electron.d.ts typed both listeners as webContents: WebContents and TypeScript consumers got no prompt to null-check. Writing the type as WebContents | null makes the generated listener signature webContents: WebContents | null for both events.

Checklist

  • PR description included
  • npm run create-typescript-definitions shows the listener param becoming nullable
  • PR title follows semantic commit guidelines

Release Notes

Notes: Fixed the TypeScript type of the webContents argument to app's login and select-client-certificate events, which is null for net and utility-process requests.

…certificate'

Both events are emitted with a null webContents for requests that don't
come from a renderer (net.fetch/net.request, utility processes), and the
prose says so, but the parameter was marked "(optional)", which the
definitions generator ignores for a non-trailing event argument. The
generated listener types therefore said `webContents: WebContents`.
Writing the type as `WebContents | null` makes electron.d.ts match.

No-Verification-Needed: docs-only change; verified by regenerating electron.d.ts.
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Aug 26, 2026
@electron-cation electron-cation Bot added documentation 📓 new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Aug 26, 2026
@MarshallOfSound
MarshallOfSound merged commit b6178c3 into main Aug 28, 2026
84 checks passed
@release-clerk

release-clerk Bot commented Aug 28, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed the TypeScript type of the webContents argument to app's login and select-client-certificate events, which is null for net and utility-process requests.

@MarshallOfSound
MarshallOfSound deleted the docs-nullable-webcontents-events branch August 28, 2026 02:16
@trop

trop Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Aug 28, 2026
@trop

trop Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "42-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #53248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y documentation 📓 merged/44-x-y PR was merged to the "44-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants