Skip to content

Commit f6886ab

Browse files
author
Phil Sturgeon
authored
Merge pull request #225 from medfreeman/fix/types
feat: add `JSONSchema7` types fix: fixed strict mode for resolve Options key
2 parents 7a899bc + dab6137 commit f6886ab

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/index.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type } from "json-schema";
1+
import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type, JSONSchema7, JSONSchema7Type } from "json-schema";
22

33
export = $RefParser;
44

@@ -173,7 +173,7 @@ declare class $RefParser {
173173
// eslint-disable-next-line no-redeclare
174174
declare namespace $RefParser {
175175

176-
export type JSONSchema = JSONSchema4 | JSONSchema6;
176+
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
177177
export type SchemaCallback = (err: Error | null, schema?: JSONSchema) => any;
178178
export type $RefsCallback = (err: Error | null, $refs?: $Refs) => any;
179179

@@ -208,7 +208,7 @@ declare namespace $RefParser {
208208
file?: Partial<ResolverOptions> | boolean;
209209
http?: HTTPResolverOptions | boolean;
210210
} & {
211-
[key: string]: Partial<ResolverOptions> | boolean;
211+
[key: string]: Partial<ResolverOptions> | HTTPResolverOptions | boolean | undefined;
212212
};
213213

214214
/**
@@ -284,7 +284,7 @@ declare namespace $RefParser {
284284
read(
285285
file: FileInfo,
286286
callback?: (error: Error | null, data: string | null) => any
287-
): string | Buffer | Promise<string | Buffer>;
287+
): string | Buffer | JSONSchema | Promise<string | Buffer | JSONSchema>;
288288
}
289289

290290
export interface ParserOptions {
@@ -395,15 +395,15 @@ declare namespace $RefParser {
395395
*
396396
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
397397
*/
398-
public get($ref: string): JSONSchema4Type | JSONSchema6Type
398+
public get($ref: string): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type
399399

400400
/**
401401
* Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
402402
*
403403
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
404404
* @param value The value to assign. Can be anything (object, string, number, etc.)
405405
*/
406-
public set($ref: string, value: JSONSchema4Type | JSONSchema6Type): void
406+
public set($ref: string, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type): void
407407
}
408408

409409
export type JSONParserErrorType = "EUNKNOWN" | "EPARSER" | "EUNMATCHEDPARSER" | "ERESOLVER" | "EUNMATCHEDRESOLVER" | "EMISSINGPOINTER" | "EINVALIDPOINTER";

0 commit comments

Comments
 (0)