Skip to content

Commit ffa8e17

Browse files
committed
add string type hints for enum params
1 parent 7c59a1b commit ffa8e17

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/extractionconfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type ExtractionConfigOptions = {
2626
extraction_prompt?: string;
2727
extraction_model?: string;
2828
is_document_compressed?: boolean;
29-
document_compression_format?: string | CompressionFormat;
29+
document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
3030
webhook?: string;
3131
};
3232

@@ -40,7 +40,7 @@ export class ExtractionConfig {
4040
extraction_prompt?: string;
4141
extraction_model?: string;
4242
is_document_compressed?: boolean;
43-
document_compression_format?: string | CompressionFormat;
43+
document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
4444
webhook?: string;
4545

4646
constructor(options: ExtractionConfigOptions) {

src/scrapeconfig.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ type ScrapeConfigOptions = {
5959
proxy_pool?: string;
6060
session?: string;
6161
tags?: string[];
62-
format?: string | Format;
63-
format_options?: string[] | FormatOption[];
62+
format?: 'json' | 'text' | 'markdown' | 'clean_html' | 'raw' | Format;
63+
format_options?: ('no_links' | 'no_images' | 'only_content')[] | FormatOption[];
6464
correlation_id?: string;
6565
cookies?: Rec<string>;
6666
body?: string;
@@ -70,7 +70,7 @@ type ScrapeConfigOptions = {
7070
rendering_wait?: number;
7171
wait_for_selector?: string;
7272
screenshots?: Rec<any>;
73-
screenshot_flags?: string[] | ScreenshotFlags[] ;
73+
screenshot_flags?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | 'high_quality')[] | ScreenshotFlags[];
7474
session_sticky_proxy?: boolean;
7575
webhook?: string;
7676
timeout?: number;
@@ -101,8 +101,8 @@ export class ScrapeConfig {
101101
proxy_pool?: string;
102102
session?: string;
103103
tags: Set<string> = new Set<string>();
104-
format?: Format| string; // raw(unchanged)
105-
format_options?: string[] | FormatOption[];
104+
format?: 'json' | 'text' | 'markdown' | 'clean_html' | 'raw' | Format;
105+
format_options?: ('no_links' | 'no_images' | 'only_content')[] | FormatOption[];
106106
correlation_id?: string;
107107
cookies?: Rec<string>;
108108
body?: string;
@@ -113,7 +113,7 @@ export class ScrapeConfig {
113113
wait_for_selector?: string;
114114
session_sticky_proxy = false;
115115
screenshots?: Rec<any>;
116-
screenshot_flags?: ScreenshotFlags[] | string[];
116+
screenshot_flags?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format' | 'high_quality')[] | ScreenshotFlags[];
117117
webhook?: string;
118118
timeout?: number; // in milliseconds
119119
js_scenario?: Rec<any>;

src/screenshotconfig.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ export enum Format {
3434

3535
type ScreenshotConfigOptions = {
3636
url: string;
37-
format?: string | Format;
37+
format?: 'jpg'| 'png' | 'webp'| 'gif' | Format;
3838
capture?: string;
3939
resolution?: string;
4040
country?: string;
4141
timeout?: number;
4242
rendering_wait?: number;
4343
wait_for_selector?: string;
44-
options?: string[] | Options[];
44+
options?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format')[] | Options[];
4545
auto_scroll?: boolean;
4646
js?: string;
4747
cache?: boolean;
@@ -52,14 +52,14 @@ type ScreenshotConfigOptions = {
5252

5353
export class ScreenshotConfig {
5454
url: string;
55-
format?: string | Format;
55+
format?: 'jpg'| 'png' | 'webp'| 'gif' | Format;
5656
capture?: string;
5757
resolution?: string;
5858
country?: string = undefined;
5959
timeout?: number;
6060
rendering_wait?: number;
6161
wait_for_selector?: string;
62-
options?: string[] | Options[];
62+
options?: ('load_images' | 'dark_mode' | 'block_banners' | 'print_media_format')[] | Options[];
6363
auto_scroll?: boolean;
6464
js?: string;
6565
cache?: boolean;

0 commit comments

Comments
 (0)