fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #3508 from hey-api/fix/dsl-reserved

chore: expand list of reserved keywords

authored by

Lubos and committed by
GitHub
e96c2e2f c3055895

+92 -12
+5
.changeset/busy-poets-attack.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + **dsl**: expand list of JavaScript globals
+65 -4
packages/openapi-ts/src/ts-dsl/utils/__tests__/name.test.ts
··· 5 5 name: string; 6 6 output: string; 7 7 }> = [ 8 + // browser globals 8 9 { 9 10 name: 'document', 10 11 output: 'document_', ··· 97 98 name: 'URLSearchParams', 98 99 output: 'URLSearchParams_', 99 100 }, 100 - { 101 - name: 'console', 102 - output: 'console_', 103 - }, 101 + // JavaScript globals 104 102 { 105 103 name: 'Array', 106 104 output: 'Array_', ··· 108 106 { 109 107 name: 'ArrayBuffer', 110 108 output: 'ArrayBuffer_', 109 + }, 110 + { 111 + name: 'atob', 112 + output: 'atob_', 111 113 }, 112 114 { 113 115 name: 'BigInt', ··· 118 120 output: 'Boolean_', 119 121 }, 120 122 { 123 + name: 'btoa', 124 + output: 'btoa_', 125 + }, 126 + { 127 + name: 'clearInterval', 128 + output: 'clearInterval_', 129 + }, 130 + { 131 + name: 'clearTimeout', 132 + output: 'clearTimeout_', 133 + }, 134 + { 135 + name: 'console', 136 + output: 'console_', 137 + }, 138 + { 139 + name: 'crypto', 140 + output: 'crypto_', 141 + }, 142 + { 121 143 name: 'DataView', 122 144 output: 'DataView_', 123 145 }, ··· 134 156 output: 'Function_', 135 157 }, 136 158 { 159 + name: 'globalThis', 160 + output: 'globalThis_', 161 + }, 162 + { 163 + name: 'Infinity', 164 + output: 'Infinity_', 165 + }, 166 + { 167 + name: 'Intl', 168 + output: 'Intl_', 169 + }, 170 + { 137 171 name: 'JSON', 138 172 output: 'JSON_', 139 173 }, ··· 146 180 output: 'Math_', 147 181 }, 148 182 { 183 + name: 'NaN', 184 + output: 'NaN_', 185 + }, 186 + { 149 187 name: 'Number', 150 188 output: 'Number_', 151 189 }, ··· 154 192 output: 'Object_', 155 193 }, 156 194 { 195 + name: 'performance', 196 + output: 'performance_', 197 + }, 198 + { 157 199 name: 'Promise', 158 200 output: 'Promise_', 159 201 }, ··· 162 204 output: 'Proxy_', 163 205 }, 164 206 { 207 + name: 'queueMicrotask', 208 + output: 'queueMicrotask_', 209 + }, 210 + { 165 211 name: 'Reflect', 166 212 output: 'Reflect_', 167 213 }, ··· 174 220 output: 'Set_', 175 221 }, 176 222 { 223 + name: 'setInterval', 224 + output: 'setInterval_', 225 + }, 226 + { 227 + name: 'setTimeout', 228 + output: 'setTimeout_', 229 + }, 230 + { 177 231 name: 'String', 178 232 output: 'String_', 233 + }, 234 + { 235 + name: 'structuredClone', 236 + output: 'structuredClone_', 179 237 }, 180 238 { 181 239 name: 'Symbol', ··· 189 247 name: 'WeakSet', 190 248 output: 'WeakSet_', 191 249 }, 250 + // JavaScript keywords 192 251 { 193 252 name: 'arguments', 194 253 output: 'arguments_', ··· 389 448 name: 'yield', 390 449 output: 'yield_', 391 450 }, 451 + // Node.js globals 392 452 { 393 453 name: '__dirname', 394 454 output: '__dirname_', ··· 421 481 name: 'Buffer', 422 482 output: 'Buffer_', 423 483 }, 484 + // TypeScript keywords 424 485 { 425 486 name: 'any', 426 487 output: 'any_',
+22 -8
packages/openapi-ts/src/ts-dsl/utils/keywords.ts
··· 1 1 const browserGlobals = [ 2 - 'document', 3 - 'fetch', 4 - 'history', 5 - 'location', 6 - 'navigator', 7 - 'window', 8 2 'AbortController', 9 3 'AbortSignal', 10 4 'Blob', 11 5 'CustomEvent', 6 + 'document', 12 7 'Event', 13 8 'EventTarget', 9 + 'fetch', 14 10 'File', 15 11 'FileList', 16 12 'FileReader', 17 13 'FormData', 18 14 'Headers', 15 + 'history', 16 + 'location', 17 + 'navigator', 19 18 'Request', 20 19 'Response', 21 20 'TextDecoder', 22 21 'TextEncoder', 23 22 'URL', 24 23 'URLSearchParams', 24 + 'window', 25 25 ]; 26 26 27 27 const javaScriptGlobals = [ 28 - 'console', 29 28 'Array', 30 29 'ArrayBuffer', 30 + 'atob', 31 31 'BigInt', 32 32 'Boolean', 33 + 'btoa', 34 + 'clearInterval', 35 + 'clearTimeout', 36 + 'console', 37 + 'crypto', 33 38 'DataView', 34 39 'Date', 35 40 'Error', 36 41 'Function', 42 + 'globalThis', 43 + 'Infinity', 44 + 'Intl', 37 45 'JSON', 38 46 'Map', 39 47 'Math', 48 + 'NaN', 40 49 'Number', 41 50 'Object', 51 + 'performance', 42 52 'Promise', 43 53 'Proxy', 54 + 'queueMicrotask', 44 55 'Reflect', 45 56 'RegExp', 46 57 'Set', 58 + 'setInterval', 59 + 'setTimeout', 47 60 'String', 61 + 'structuredClone', 48 62 'Symbol', 49 63 'WeakMap', 50 64 'WeakSet', ··· 106 120 const nodeGlobals = [ 107 121 '__dirname', 108 122 '__filename', 123 + 'Buffer', 109 124 'exports', 110 125 'global', 111 126 'module', 112 127 'process', 113 128 'require', 114 - 'Buffer', 115 129 ]; 116 130 117 131 const typeScriptKeywords = [