Skip to content

fix(cli): add defaultValue overloads and typed key unions to typegen output#27

Merged
olamide226 merged 2 commits intomainfrom
fix/typegen-get-overloads
Mar 14, 2026
Merged

fix(cli): add defaultValue overloads and typed key unions to typegen output#27
olamide226 merged 2 commits intomainfrom
fix/typegen-get-overloads

Conversation

@olamide226
Copy link
Copy Markdown
Contributor

Summary

  • get() in the REP interface now emits both overload signatures (defaultValue: stringstring, defaultValue?: undefinedstring | undefined), matching the SDK's actual implementation
  • Standalone exported get() gains the same two overloads with the typed public key union (was incorrectly key: string)
  • Standalone exported getSecure() now uses the typed sensitive key union instead of key: string

Why

The SDK declares get() with two overloads (§5.2) so callers get a narrowed string return type when they pass a default value. The typegen was silently dropping both overloads, meaning consumers lost the type narrowing and got no autocomplete on key names for the standalone exports.

Test plan

  • Run rep typegen against a manifest with public + sensitive vars and verify the generated .d.ts includes both get() overloads with the typed key union
  • Confirm rep.get('KEY', 'fallback') resolves to string (not string | undefined) in a consuming project
  • Confirm rep.get('KEY') still resolves to string | undefined
  • Confirm passing an unknown key to get() or getSecure() is a TypeScript error

…output

The generated .d.ts was missing the defaultValue overload signatures for
get() in both the REP interface and standalone exports, and standalone
get()/getSecure() used key: string instead of the typed key union.

Now fully mirrors the SDK's actual overload signatures per §5.2.
Copilot AI review requested due to automatic review settings March 14, 2026 23:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the CLI’s TypeScript typegen output so generated declarations better match the SDK’s get() overload behavior and provide typed key unions for standalone exports.

Changes:

  • Emit both get() overload signatures in the generated REP interface so defaultValue narrows the return type to string.
  • Generate standalone exported get() overloads using the typed public key union (instead of key: string).
  • Generate standalone exported getSecure() using the typed sensitive key union (instead of key: string).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@olamide226 olamide226 merged commit 97e372c into main Mar 14, 2026
9 checks passed
@olamide226 olamide226 deleted the fix/typegen-get-overloads branch March 14, 2026 23:37
@github-actions github-actions bot mentioned this pull request Mar 14, 2026
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.

2 participants