Commit 4942b07
authored
fix(node): relax Fastify's
When using
[exactOptionalPropertyTypes](https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes),
it is pretty hard to match Fastify's instance types given all the
missing overloads from the partial signature we have. The problematic
area is around `addHook`.
We either need to have all the signatures implemented exactly, or
outright import Fastify's types which is not ideal since it is not a
dependency.
I opted to relax the types specifically for `setupFastifyErrorHandler`
by providing a minimal instance with the one method it needs to avoid TS
trying to matching the other properties and methods signatures, not
ideal but simple enough.
I verified that this works for Fastify v3 throughout v5
closes #18619setupFastifyErrorHandler argument type (#18620)1 parent 8787a87 commit 4942b07
2 files changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
30 | 39 | | |
31 | 40 | | |
32 | 41 | | |
| |||
0 commit comments