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
// fileA.ts
const router = RestypedRouter<MyAPI>(app);
configureRouter(router);
// fileB.ts
function configureRouter(router: any) { // <-- What type here
// do stuff with router
}
As you can see from the code I am passing RestypedRouter as parameter to a function because I am doing stuff with it inside the function. But the problem is that I can't get the type for the router.
When I look generated index.d.ts file inside node_modules/restyped-express-async I will see definition like this
⚠️ Workaround:
My current workaround is just to copy paste the code above to my own source code. But this is not maintainable because if the type changes in Restyped library I have change my local source code too which is not idea.
👑 Please tell me if you have any questions and tell me if this is clear for you 👍
The text was updated successfully, but these errors were encountered:
Hey, I know it's been two years but if you're still interested in this, I forked this package to ianmartorell/restyped-express and I also want to use the function type in my code, but I'm not sure what's the best way to go about adding it. Any help would be appreciated.
I have situation like this:
As you can see from the code I am passing
RestypedRouter
as parameter to a function because I am doing stuff with it inside the function. But the problem is that I can't get the type for the router.When I look generated
index.d.ts
file insidenode_modules/restyped-express-async
I will see definition like thisAs you can see the return type of
AsyncRouter
is NOT exported.🍏 Solution
Export return type as type. Add something like this to the types
My current workaround is just to copy paste the code above to my own source code. But this is not maintainable because if the type changes in Restyped library I have change my local source code too which is not idea.
👑 Please tell me if you have any questions and tell me if this is clear for you 👍
The text was updated successfully, but these errors were encountered: