How to infer types from an Elysia handler to another one? #705
Answered
by
binamralamsal
binamralamsal
asked this question in
Q&A
-
This is my code: const app = new Elysia()
.use(
jwt({
name: "jwt",
secret: env.JWT_SECRET,
})
)
.get("/", ({ jwt }) => {
// can access here
})
.use(authRoutes)
const authRoutes = new Elysia({ prefix: "/auth" })
.get("/", ({ jwt }) => {
// Typescript will complain if I try to use jwt here
} ) How can I share types from main Elysia handler to another one? |
Beta Was this translation helpful? Give feedback.
Answered by
binamralamsal
Jul 6, 2024
Replies: 1 comment
-
Got my answer: https://elysiajs.com/essential/plugin#service-locator |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
binamralamsal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got my answer: https://elysiajs.com/essential/plugin#service-locator