Lack of Type Safety When Extending Express API with Custom Response Methods #6529
Unanswered
hardikkheni
asked this question in
Q&A
Replies: 1 comment
-
can we do this? or there is any problem doing this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Express community,
I'm exploring the feature of extending the Express API, as documented here, to add custom response methods. While this is a powerful feature, I've encountered what appears to be a lack of type safety when implementing these custom methods, particularly when using TypeScript.
For example, I've defined a custom
AuthUser
type:And extended the
express.Response
object with a custom success method:Now, this should provide type-safety but lack 2 (see attachment image) generic missing from express types.
so My question is that is it valid and
if yes then can someone guild me to make first OS PR to express's types.
if not then how can i archive this?.
Thanks.
DefinitelyTyped/DefinitelyTyped#72855
Beta Was this translation helpful? Give feedback.
All reactions