fix(settings): accept union-valued permission targets without mode

Merged
TH
4d ago
+36-5

Summary

Restore mode-free settings.update calls with union-valued permissions, fixing the downstream E2E build after #5026. A separate call overload accepts the union. The exported SettingsUpdateOptions preserves photos narrowing. Six files cover SDK types and tests. Runtime behavior is unchanged.

Before / after

declare const permission: 'camera' | 'photos';
client.settings.update({ setting: 'permission', permission, state: 'grant' });

At base, the call fails typecheck. At head, it compiles without a cast. Adding an explicit mode to the union still fails. A photos-specific handler still accepts a SettingsUpdateOptions value guarded by permission === 'photos'.

Validation

  • Base: 8a29aea9a820. The original union-call regression failed there. The new narrowing regression fails on 29fb4b9.
  • Head: 1cbe1eaeb6fa3ea90a95a7e6836b935739638192. TypeScript build and all 59 focused tests passed.
  • pnpm check:affected --run --head HEAD passed at the exact commit (receipt run-q29RJ2). Hosted CI covers the remaining lanes.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.