Skip to content

Commit ad34788

Browse files
authored
Allow for autocomplete on string literals
Ref: https://twitter.com/thoughtspile/status/1639240110787919875
1 parent 4171e2a commit ad34788

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

types/index.d.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ declare module 'cloudinary' {
66
/****************************** Constants *************************************/
77
/****************************** Transformations *******************************/
88
type CropMode =
9+
| (string & {})
910
| "scale"
1011
| "fit"
1112
| "limit"
@@ -20,6 +21,7 @@ declare module 'cloudinary' {
2021
| "imagga_crop"
2122
| "imagga_scale";
2223
type Gravity =
24+
| (string & {})
2325
| "north_west"
2426
| "north"
2527
| "north_east"
@@ -57,8 +59,9 @@ declare module 'cloudinary' {
5759
| "auto:none"
5860
| "liquid"
5961
| "ocr_text";
60-
type Angle = number | string | Array<number | string> | "auto_right" | "auto_left" | "ignore" | "vflip" | "hflip";
62+
type Angle = number | (string & {}) | Array<number | string> | "auto_right" | "auto_left" | "ignore" | "vflip" | "hflip";
6163
type ImageEffect =
64+
| (string & {})
6265
| "hue"
6366
| "red"
6467
| "green"
@@ -109,11 +112,11 @@ declare module 'cloudinary' {
109112
| "gamma"
110113
| "improve";
111114

112-
type VideoEffect = string | "accelerate" | "reverse" | "boomerang" | "loop" | "make_transparent" | "transition";
113-
type AudioCodec = string | "none" | "aac" | "vorbis" | "mp3";
115+
type VideoEffect = (string & {}) | "accelerate" | "reverse" | "boomerang" | "loop" | "make_transparent" | "transition";
116+
type AudioCodec = (string & {}) | "none" | "aac" | "vorbis" | "mp3";
114117
type AudioFrequency =
115118
string
116-
| number
119+
| (number & {})
117120
| 8000
118121
| 11025
119122
| 16000
@@ -130,7 +133,7 @@ declare module 'cloudinary' {
130133
| 192000;
131134
/****************************** Flags *************************************/
132135
type ImageFlags =
133-
string
136+
| (string & {})
134137
| Array<string>
135138
| "any_format"
136139
| "attachment"
@@ -163,6 +166,7 @@ declare module 'cloudinary' {
163166
| "tiff8_lzw"
164167
| "tiled";
165168
type VideoFlags =
169+
| (string & {})
166170
| Array<string>
167171
| "animated"
168172
| "awebp"
@@ -177,8 +181,9 @@ declare module 'cloudinary' {
177181
| "relative"
178182
| "truncate_ts"
179183
| "waveform";
180-
type ColorSpace = "srgb" | "no_cmyk" | "keep_cmyk";
184+
type ColorSpace = (string & {}) | "srgb" | "no_cmyk" | "keep_cmyk";
181185
type DeliveryType =
186+
| (string & {})
182187
| "upload"
183188
| "private"
184189
| "authenticated"
@@ -199,8 +204,9 @@ declare module 'cloudinary' {
199204
| "worldstarhiphop"
200205
| "dailymotion";
201206
/****************************** URL *************************************/
202-
type ResourceType = "image" | "raw" | "video";
207+
type ResourceType = (string & {}) | "image" | "raw" | "video";
203208
type ImageFormat =
209+
| (string & {})
204210
| "gif"
205211
| "png"
206212
| "jpg"
@@ -226,6 +232,7 @@ declare module 'cloudinary' {
226232
| "tga"
227233
| "heic"
228234
type VideoFormat =
235+
| (string & {})
229236
| "auto"
230237
| "flv"
231238
| "m3u8"
@@ -254,7 +261,7 @@ declare module 'cloudinary' {
254261
angle?: Angle;
255262
radius?: number | string;
256263
overlay?: string | object;
257-
custom_function?: string | { function_type: string | "wasm" | "remote", source: string }
264+
custom_function?: string | { function_type: (string & {}) | "wasm" | "remote", source: string }
258265
variables?: Array<string | object>;
259266
if?: string;
260267
else?: string;
@@ -553,11 +560,11 @@ declare module 'cloudinary' {
553560
type AdminAndUpdateApiOptions = AdminApiOptions | UpdateApiOptions;
554561

555562
/****************************** API *************************************/
556-
type Status = "pending" | "approved" | "rejected";
557-
type StreamingProfiles = "4k" | "full_hd" | "hd" | "sd" | "full_hd_wifi" | "full_hd_lean" | "hd_lean";
558-
type ModerationKind = "manual" | "webpurify" | "aws_rek" | "metascan";
559-
type AccessMode = "public" | "authenticated";
560-
type TargetArchiveFormat = "zip" | "tgz";
563+
type Status = (string & {}) | "pending" | "approved" | "rejected";
564+
type StreamingProfiles = (string & {}) | "4k" | "full_hd" | "hd" | "sd" | "full_hd_wifi" | "full_hd_lean" | "hd_lean";
565+
type ModerationKind = (string & {}) | "manual" | "webpurify" | "aws_rek" | "metascan";
566+
type AccessMode = (string & {}) | "public" | "authenticated";
567+
type TargetArchiveFormat = (string & {}) | "zip" | "tgz";
561568

562569
// err is kept for backwards compatibility, it currently will always be undefined
563570
type ResponseCallback = (err?: any, callResult?: any) => any;

0 commit comments

Comments
 (0)