@types/express-serve-static-core
: "Type instantiation is excessively deep and possibly infinite" error with sufficiently long route parameters
#54158
Unanswered
daviduzumeri
asked this question in
Issues with a @types package
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The latest version of
@types/express-serve-static-core
further improves thereq.params
inference from the actual parameter string, which is a very neat feature (although hard to use if you separate your route definitions from your handler functions). However, the complex logic also causes a TypeScript error once you introduce a route that's long enough. For instance (from a quick package with just@types/node
,@types/express
,typescript
andexpress
):I'm trying to pin down exactly what the trigger here is, but something about using a sufficiently long route parameter name, when it's not the first parameter in the route, triggers a TS error about type instantiation. While the parameter inference is a very cool feature, given the fact that it's introducing issues like this and its limited functionality when working with separated handlers from routes (a fairly common pattern), I'm wondering if some level of rollback might make sense until these issues are dealt with? From looking at the implementation, I'm not sure if there is a solution that will maintain the current functionality.
Beta Was this translation helpful? Give feedback.
All reactions