Summary
The TypeScript response types in the crw-sdk package are very generic, making it difficult to use the SDK with proper type safety and IntelliSense.
Currently the SDK exposes:
export type ScrapeResult = Json;
export type CrawlResult = Json[];
export type SearchResult = Json | Json[];
export type ParseResult = Json;
/** Native `/v1/extract` returns one result object per URL, in request order. */
export type ExtractResult = ExtractUrlResult[];
// ...
Problem
Since ScrapeResult is just Json, TypeScript cannot infer any of the response properties.
For example, fields such as:
markdown
metadata
images
links
actions
- etc.
are not typed, so users lose autocomplete and compile-time type checking.
Expected behavior
It would be helpful if the SDK exported detailed interfaces for the API responses instead of Json.
For example:
interface ScrapeResult {
markdown?: string;
html?: string;
metadata?: ScrapeMetadata;
images?: ScrapeImage[];
actions?: ScrapeAction[];
// ...
}
This would provide much better IntelliSense and make the SDK easier to use in TypeScript projects.
Summary
The TypeScript response types in the
crw-sdkpackage are very generic, making it difficult to use the SDK with proper type safety and IntelliSense.Currently the SDK exposes:
Problem
Since
ScrapeResultis justJson, TypeScript cannot infer any of the response properties.For example, fields such as:
markdownmetadataimageslinksactionsare not typed, so users lose autocomplete and compile-time type checking.
Expected behavior
It would be helpful if the SDK exported detailed interfaces for the API responses instead of
Json.For example:
This would provide much better IntelliSense and make the SDK easier to use in TypeScript projects.