cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v5.2.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/internal/qs/types.ts

71lines · modecode

1export type Format = 'RFC1738' | 'RFC3986';
2
3export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
4export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string;
5
6export type BooleanOptional = boolean | undefined;
7
8export type StringifyBaseOptions = {
9 delimiter?: string;
10 allowDots?: boolean;
11 encodeDotInKeys?: boolean;
12 strictNullHandling?: boolean;
13 skipNulls?: boolean;
14 encode?: boolean;
15 encoder?: (
16 str: any,
17 defaultEncoder: DefaultEncoder,
18 charset: string,
19 type: 'key' | 'value',
20 format?: Format,
21 ) => string;
22 filter?: Array<PropertyKey> | ((prefix: PropertyKey, value: any) => any);
23 arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
24 indices?: boolean;
25 sort?: ((a: PropertyKey, b: PropertyKey) => number) | null;
26 serializeDate?: (d: Date) => string;
27 format?: 'RFC1738' | 'RFC3986';
28 formatter?: (str: PropertyKey) => string;
29 encodeValuesOnly?: boolean;
30 addQueryPrefix?: boolean;
31 charset?: 'utf-8' | 'iso-8859-1';
32 charsetSentinel?: boolean;
33 allowEmptyArrays?: boolean;
34 commaRoundTrip?: boolean;
35};
36
37export type StringifyOptions = StringifyBaseOptions;
38
39export type ParseBaseOptions = {
40 comma?: boolean;
41 delimiter?: string | RegExp;
42 depth?: number | false;
43 decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any;
44 arrayLimit?: number;
45 parseArrays?: boolean;
46 plainObjects?: boolean;
47 allowPrototypes?: boolean;
48 allowSparse?: boolean;
49 parameterLimit?: number;
50 strictDepth?: boolean;
51 strictNullHandling?: boolean;
52 ignoreQueryPrefix?: boolean;
53 charset?: 'utf-8' | 'iso-8859-1';
54 charsetSentinel?: boolean;
55 interpretNumericEntities?: boolean;
56 allowEmptyArrays?: boolean;
57 duplicates?: 'combine' | 'first' | 'last';
58 allowDots?: boolean;
59 decodeDotInKeys?: boolean;
60};
61
62export type ParseOptions = ParseBaseOptions;
63
64export type ParsedQs = {
65 [key: string]: undefined | string | string[] | ParsedQs | ParsedQs[];
66};
67
68// Type to remove null or undefined union from each property
69export type NonNullableProperties<T> = {
70 [K in keyof T]-?: Exclude<T[K], undefined | null>;
71};
72