Skip to content

fix(experimental): widen var-bound inputs from parent scope and customize - #203

Merged
ping-maxwell merged 1 commit into
better-auth:experimentalfrom
ping-maxwell:feat/experimental-widen-var-input-parent-scope
Sep 2, 2026
Merged

fix(experimental): widen var-bound inputs from parent scope and customize#203
ping-maxwell merged 1 commit into
better-auth:experimentalfrom
ping-maxwell:feat/experimental-widen-var-input-parent-scope

Conversation

@ping-maxwell

Copy link
Copy Markdown
Collaborator

Used endpoints defined against a base var should pick up later parent-mounted v.extend and customize shadows at both the type and validation layers.

…mize

Used endpoints defined against a base var should pick up later parent-mounted
v.extend and customize shadows at both the type and validation layers.
@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/better-call@203

commit: b61661b

@ping-maxwell
ping-maxwell merged commit 61da7ff into better-auth:experimental Sep 2, 2026
6 checks passed
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

The PR widens var-bound endpoint inputs using extensions and customized same-name vars inherited from parent builders.

  • Adds full-chain type rewriting for functions exposed through nested builders.
  • Treats mounted customized vars as runtime input extensions.
  • Adds type and runtime tests for additive customized fields and parent-mounted extensions.

Confidence Score: 4/5

The PR should not merge until replacement customizations preserve shadow precedence instead of producing impossible input types and order-dependent runtime values.

Same-name customized schemas are intersected with their base declarations and both are applied at runtime, which breaks the existing replace customization path whenever fields are removed or changed.

Files Needing Attention: packages/experimental/src/module.ts, packages/experimental/src/fn.ts

Fix all with Greploop Fix All in Cursor Fix All in Codex Fix All in Claude Code

Reviews (1): Last reviewed commit: "fix(experimental): widen var-bound input..." | Re-trigger Greptile

* top level; a var used as a field widens that field. `unknown` when
* nothing applies.
*/
export type InputVarExtra<PL, I> = I extends {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Replacement shadows become intersections

When a mounted var and its same-name customized re-export use replace to remove a field or change its type, VarArgsInScope and VarValuesInScope intersect both declarations instead of applying shadow precedence. For example, replacing { id: string } with { id: number } produces { id: never } at the call site and in c.input, while runtime applies both schemas in module order, rejecting valid customized calls or producing values that disagree with the declared type.

Fix in Cursor Fix in Codex Fix in Claude Code

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.

1 participant