@@ -37,7 +37,7 @@ export type RefParserSchema = string | JSONSchema;
3737 *
3838 * @class
3939 */
40- export class $RefParser < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > {
40+ export class $RefParser < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > {
4141 /**
4242 * The parsed (and possibly dereferenced) JSON schema object
4343 *
@@ -52,7 +52,7 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
5252 * @type {$Refs }
5353 * @readonly
5454 */
55- $refs = new $Refs < S > ( ) ;
55+ $refs = new $Refs < S , O > ( ) ;
5656
5757 /**
5858 * Parses the given JSON schema.
@@ -143,32 +143,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
143143 }
144144 }
145145
146- public static parse < S extends JSONSchema = JSONSchema > ( schema : S | string ) : Promise < S > ;
147- public static parse < S extends JSONSchema = JSONSchema > (
146+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
147+ schema : S | string ,
148+ ) : Promise < S > ;
149+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
148150 schema : S | string ,
149151 callback : SchemaCallback < S > ,
150152 ) : Promise < void > ;
151- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
153+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
152154 schema : S | string ,
153155 options : O ,
154156 ) : Promise < S > ;
155- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
157+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
156158 schema : S | string ,
157159 options : O ,
158160 callback : SchemaCallback < S > ,
159161 ) : Promise < void > ;
160- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
162+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
161163 baseUrl : string ,
162164 schema : S | string ,
163165 options : O ,
164166 ) : Promise < S > ;
165- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
167+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
166168 baseUrl : string ,
167169 schema : S | string ,
168170 options : O ,
169171 callback : SchemaCallback < S > ,
170172 ) : Promise < void > ;
171- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
173+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
172174 | Promise < S >
173175 | Promise < void > {
174176 const parser = new $RefParser < S , O > ( ) ;
@@ -186,12 +188,12 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
186188 * @param options (optional)
187189 * @param callback (optional) A callback that will receive a `$Refs` object
188190 */
189- public resolve ( schema : S | string ) : Promise < $Refs < S > > ;
190- public resolve ( schema : S | string , callback : $RefsCallback < S > ) : Promise < void > ;
191- public resolve ( schema : S | string , options : O ) : Promise < $Refs < S > > ;
192- public resolve ( schema : S | string , options : O , callback : $RefsCallback < S > ) : Promise < void > ;
193- public resolve ( baseUrl : string , schema : S | string , options : O ) : Promise < $Refs < S > > ;
194- public resolve ( baseUrl : string , schema : S | string , options : O , callback : $RefsCallback < S > ) : Promise < void > ;
191+ public resolve ( schema : S | string ) : Promise < $Refs < S , O > > ;
192+ public resolve ( schema : S | string , callback : $RefsCallback < S , O > ) : Promise < void > ;
193+ public resolve ( schema : S | string , options : O ) : Promise < $Refs < S , O > > ;
194+ public resolve ( schema : S | string , options : O , callback : $RefsCallback < S , O > ) : Promise < void > ;
195+ public resolve ( baseUrl : string , schema : S | string , options : O ) : Promise < $Refs < S , O > > ;
196+ public resolve ( baseUrl : string , schema : S | string , options : O , callback : $RefsCallback < S , O > ) : Promise < void > ;
195197 async resolve ( ) {
196198 const args = normalizeArgs < S , O > ( arguments ) ;
197199
@@ -216,32 +218,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
216218 * @param options (optional)
217219 * @param callback (optional) A callback that will receive a `$Refs` object
218220 */
219- public static resolve < S extends JSONSchema = JSONSchema > ( schema : S | string ) : Promise < $Refs < S > > ;
220- public static resolve < S extends JSONSchema = JSONSchema > (
221+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
222+ schema : S | string ,
223+ ) : Promise < $Refs < S , O > > ;
224+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
221225 schema : S | string ,
222- callback : $RefsCallback < S > ,
226+ callback : $RefsCallback < S , O > ,
223227 ) : Promise < void > ;
224- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
228+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
225229 schema : S | string ,
226230 options : O ,
227- ) : Promise < $Refs < S > > ;
228- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
231+ ) : Promise < $Refs < S , O > > ;
232+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
229233 schema : S | string ,
230234 options : O ,
231- callback : $RefsCallback < S > ,
235+ callback : $RefsCallback < S , O > ,
232236 ) : Promise < void > ;
233- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
237+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
234238 baseUrl : string ,
235239 schema : S | string ,
236240 options : O ,
237- ) : Promise < $Refs < S > > ;
238- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
241+ ) : Promise < $Refs < S , O > > ;
242+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
239243 baseUrl : string ,
240244 schema : S | string ,
241245 options : O ,
242- callback : $RefsCallback < S > ,
246+ callback : $RefsCallback < S , O > ,
243247 ) : Promise < void > ;
244- static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
248+ static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
245249 | Promise < S >
246250 | Promise < void > {
247251 const instance = new $RefParser < S , O > ( ) ;
@@ -259,34 +263,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
259263 * @param options (optional)
260264 * @param callback (optional) A callback that will receive the bundled schema object
261265 */
262- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
266+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
263267 schema : S | string ,
264268 ) : Promise < S > ;
265- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
269+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
266270 schema : S | string ,
267271 callback : SchemaCallback < S > ,
268272 ) : Promise < void > ;
269- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
273+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
270274 schema : S | string ,
271275 options : O ,
272276 ) : Promise < S > ;
273- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
277+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
274278 schema : S | string ,
275279 options : O ,
276280 callback : SchemaCallback < S > ,
277281 ) : Promise < void > ;
278- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
282+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
279283 baseUrl : string ,
280284 schema : S | string ,
281285 options : O ,
282286 ) : Promise < S > ;
283- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
287+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
284288 baseUrl : string ,
285289 schema : S | string ,
286290 options : O ,
287291 callback : SchemaCallback < S > ,
288292 ) : Promise < S > ;
289- static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
293+ static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
290294 | Promise < S >
291295 | Promise < void > {
292296 const instance = new $RefParser < S , O > ( ) ;
@@ -333,34 +337,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
333337 * @param options (optional)
334338 * @param callback (optional) A callback that will receive the dereferenced schema object
335339 */
336- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
340+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
337341 schema : S | string ,
338342 ) : Promise < S > ;
339- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
343+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
340344 schema : S | string ,
341345 callback : SchemaCallback < S > ,
342346 ) : Promise < void > ;
343- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
347+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
344348 schema : S | string ,
345349 options : O ,
346350 ) : Promise < S > ;
347- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
351+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
348352 schema : S | string ,
349353 options : O ,
350354 callback : SchemaCallback < S > ,
351355 ) : Promise < void > ;
352- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
356+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
353357 baseUrl : string ,
354358 schema : S | string ,
355359 options : O ,
356360 ) : Promise < S > ;
357- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
361+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
358362 baseUrl : string ,
359363 schema : S | string ,
360364 options : O ,
361365 callback : SchemaCallback < S > ,
362366 ) : Promise < void > ;
363- static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
367+ static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
364368 | Promise < S >
365369 | Promise < void > {
366370 const instance = new $RefParser < S , O > ( ) ;
@@ -400,7 +404,7 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
400404}
401405export default $RefParser ;
402406
403- function finalize < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
407+ function finalize < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
404408 parser : $RefParser < S , O > ,
405409) {
406410 const errors = JSONParserErrorGroup . getParserErrors ( parser ) ;
0 commit comments