Skip to content

fix: reject unknown properties on session() and charge() at compile time#203

Open
brendanjryan wants to merge 1 commit intomainfrom
fix/no-extra-keys
Open

fix: reject unknown properties on session() and charge() at compile time#203
brendanjryan wants to merge 1 commit intomainfrom
fix/no-extra-keys

Conversation

@brendanjryan
Copy link
Collaborator

@brendanjryan brendanjryan commented Mar 19, 2026

Problem

Makes interface for kwargs on mppx core types safer

Solution

Add a NoExtraKeys<T, Shape> utility type that maps any key in T not present in Shape to never, and apply it to session() and charge() via overload signatures.

// Before: silently accepted
tempo.session({ stream: { poll: true }, ... })

// After: compile error
// Type '{ poll: true; }' is not assignable to type 'never'
tempo.session({ stream: { poll: true }, ... })

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/mppx@203

commit: cb52419

Add NoExtraKeys utility type and apply it via overload signatures to
tempo.session() and tempo.charge(). This catches typos like
`stream: { poll: true }` instead of `sse: { poll: true }` that
previously slipped through because generic `extends` constraints
bypass excess property checking.

Fixes the class of bug from PR #159.
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