codebytere

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

Merged
Created: Aug 26, 2026, 7:44:14 AM
Merged: Aug 27, 2026, 9:16:54 PM
4 comments
Target: main

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.

Backports

42-x-y
Pending
Waiting for a manual backport
43-x-y
Pending
Waiting for a manual backport
44-x-y
Merged
PR Number
#53248
Merged At
Aug 28, 2026, 12:15:38 AM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron