fix(elysia): Widen accepted Elysia app type to support Elysia options#21164
Merged
Conversation
logaretm
approved these changes
May 26, 2026
3 tasks
s1gr1d
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a typing bug in our
Sentry.withElysiawrapping API type definitions: Previously the passedappinstance had to extendElysia. This causes problems when users pass in options that rely on const string literal types (e.g.prefixas reported in #21159).Because
Elysiadeclares itsprefixoption as a string literal to extendconst in out BasePath extends string = '', TS will throw an error if the option is provided by users but with a different string value than''. The solution is to accept anappobject of typeAnyElysia, which is an alias forElysia<any, any, ...>. This widens the type enough so that our wrapper can accept any kind of Elysia configuration.As a result, we have to type-cast to the more narrow
Elysiatype again to get properly typed contexts on some callbacks. There is a slight chance that the context objects could in reality look a bit different than what we expect in code but this was technically the case beforehand, too. I'd say this is an okay tradeoff for now. If reviewers prefer, we can be stricter and add more checks in the callbacks to see if the properties really exist.closes #21159