TypeScript improvement: Replace any
with unknown
where it makes sense
#1087
Labels
Milestone
any
with unknown
where it makes sense
#1087
As suggested by @bilalq in #1023:
As @m-radzikowski mentioned, the actual middleware typings could be improved. It'd be a breaking change, but types should use
unknown
instead ofany
. That would make them safe and force clients to validate their types match expectations without letting them unsafely access properties.In the case of the secretsManager middleware, it would be even better for it to take an optional typeguard function. That would allow for exact type awareness without needing to resort to
unknown
orany
. This would be useful even for non-TS consumers that are just using vanilla JS. If a secret value is fetched and it's shape doesn't match expectations, an error gets thrown, so the rest of the code can safely assume the secret shape is as expected.As a general observation, I don't think there are issues with the general typing of middy itself, but there are improvements that could be made to the official middleware.
[...]
Originally posted by @bilalq in #1023 (comment)
The text was updated successfully, but these errors were encountered: