You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/will-404 renders 404: world OR
the .onError handler does not typecheck
What do you see instead?
/ renders Root: world
/will-404 renders 404: undefined
Additional information
This seems to happen only when using { as: 'global' }. With 'scoped'/'local (or omitting) hello is not typed in onError (but is properly typed in e.g. handlers).
Not sure if it's the type or the runtime behavior that's wrong, but it felt natural to me to write it this way -- in particular I need to access my derived isAuthorized in onError when NOT_FOUND to avoid leaking my app structure to unauthorized users.
In my particular case { as: 'global' } is needed because I want to inject this isAuthorized globally from a plugin.
If onError (on router) isn't meant to access the derived properties (which might be the case according to the lifecycle graph, since derive happens on Transform Hook while NOT_FOUND I assume comes from Router), what's the alternative approach here, if any?
The text was updated successfully, but these errors were encountered:
alvaro-cuesta
changed the title
as: 'global'derive is typed in onError but not present in runtimeas: 'global'derive is typed in onError but not present at runtime
Apr 19, 2024
alvaro-cuesta
changed the title
as: 'global'derive is typed in onError but not present at runtimederive with { as: 'global' } is typed in onError context, but not present at runtime
Apr 19, 2024
alvaro-cuesta
changed the title
derive with { as: 'global' } is typed in onError context, but not present at runtimederive properties with { as: 'global' } are typed in onError context, but not present at runtime
Apr 19, 2024
derive shouldn't be present in onError as specified in Lifecycle.
referencing it on onError now should show a type error as 321a7c5, published under 1.0.21
What version of Elysia.JS is running?
1.0.13
What platform is your computer?
x64
What steps can reproduce the bug?
What is the expected behavior?
/
rendersRoot: world
/will-404
renders404: world
OR
the
.onError
handler does not typecheckWhat do you see instead?
/
rendersRoot: world
/will-404
renders404: undefined
Additional information
This seems to happen only when using
{ as: 'global' }
. With'scoped'
/'local
(or omitting)hello
is not typed inonError
(but is properly typed in e.g. handlers).Not sure if it's the type or the runtime behavior that's wrong, but it felt natural to me to write it this way -- in particular I need to access my derived
isAuthorized
inonError
whenNOT_FOUND
to avoid leaking my app structure to unauthorized users.In my particular case
{ as: 'global' }
is needed because I want to inject thisisAuthorized
globally from a plugin.If
onError
(on router) isn't meant to access thederive
d properties (which might be the case according to the lifecycle graph, sincederive
happenson Transform Hook
whileNOT_FOUND
I assume comes fromRouter
), what's the alternative approach here, if any?The text was updated successfully, but these errors were encountered: