apify-client-js
apify-client-js copied to clipboard
Request type could be improved
- A lot of the properties are
| undefined. Why? Is there a case where the queue would not have those properties? I think we would need 2 different types, one for request options which have mostly optional values but when you use request as a type you get from somewhere, all these will be populated by default values so the type should reflect that. handledAtshould bestring | nullasnullis a value for in progress
A lot of the properties are | undefined.
Can you list which ones? I can see loadedUrl, id, and headers, rest seems to be already mandatory. And I can already see why - the object represents a request, not necessarily processed - you don't know the loadedUrl or headers until you process it, I guess same applies for the id.
https://github.com/apify/crawlee/blob/master/packages/core/src/request.ts#L72
FYI we already have two types, one is the Request class itself, and one is the RequestOptions interface.
So we should maybe have a third interface for processed request, and use that when appropriate.