Investigate ts-check error: "Property 'x' does not exist on type 'any []'" in Delivery/index.js
Closed this issue · 3 comments
heliomar-pena commented
Screenshots
dasher-user/src/pages/Delivery/index.jsx
Lines 31 to 33 in dccbce3
dasher-user/src/pages/Delivery/index.jsx
Lines 44 to 47 in dccbce3
Checklist
- The reason why the error occurs is known
- Possible solutions were created
- It was decided between fixing the error or leaving it like that
Israel-Laguan commented
This can be solved adding proper types on JSDocs
In this cases adding @return types for useGetPackageInformation
could help
This is an example:
/**
* @param {packageID} Id coming from DB for certain package
* @return { {loading: Boolean, error:Object, packageInformation: Object}}
*/
const useGetPackageInformation = packageID => {
...
return {loading, error, packageInformation}
}
In this case we would need @typedef to type the return packageInformation as expected:
https://jsdoc.app/tags-typedef.html
Some references:
Israel-Laguan commented
BUT, at the end this should be low priority, if it gets too weird is better to ignore these types
samuel-vergara-leon commented
check that your tasks have the corresponding labels