genoc 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -181,24 +181,22 @@ function buildClientFile(operations, version) {
|
|
|
181
181
|
lines.push('/* global FormData */');
|
|
182
182
|
}
|
|
183
183
|
lines.push('');
|
|
184
|
-
lines.push("const errorsSymbol = Symbol('errors');");
|
|
185
|
-
lines.push('');
|
|
186
184
|
lines.push('function decorateWithErrors<T, E>(');
|
|
187
185
|
lines.push(' item: T,');
|
|
188
186
|
lines.push(' runtimeErrors: unknown,');
|
|
189
|
-
lines.push('): T & {
|
|
190
|
-
lines.push(' Object.defineProperty(item,
|
|
187
|
+
lines.push('): T & { __definedErrors: E } {');
|
|
188
|
+
lines.push(' Object.defineProperty(item, "__definedErrors", {');
|
|
191
189
|
lines.push(' value: runtimeErrors,');
|
|
192
190
|
lines.push(' enumerable: false,');
|
|
193
191
|
lines.push(' configurable: true,');
|
|
194
192
|
lines.push(' writable: false,');
|
|
195
193
|
lines.push(' });');
|
|
196
|
-
lines.push(' return item as T & {
|
|
194
|
+
lines.push(' return item as T & { __definedErrors: E };');
|
|
197
195
|
lines.push('}');
|
|
198
196
|
lines.push('');
|
|
199
197
|
lines.push('export function isDefinedError<E extends ApiError<number, unknown>>(');
|
|
200
198
|
lines.push(' err: unknown,');
|
|
201
|
-
lines.push(' fn: {
|
|
199
|
+
lines.push(' fn: { __definedErrors: E },');
|
|
202
200
|
lines.push('): err is E {');
|
|
203
201
|
lines.push(' if (err instanceof UnspecifiedApiError) return false;');
|
|
204
202
|
lines.push(' if (!(err instanceof ApiError)) return false;');
|