Skip to content

Commit 106aa70

Browse files
authored
chore: export the JSONSchema type (#238)
* export the JSONSchema type * move JSONSchema to types.ts
1 parent 45bb66c commit 106aa70

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { convertInternalToExpanded } from './schema-converters/internalToExpande
2121
import { convertInternalToMongodb } from './schema-converters/internalToMongoDB';
2222
import { convertInternalToStandard } from './schema-converters/internalToStandard';
2323
import * as schemaStats from './stats';
24-
import { AnyIterable, StandardJSONSchema, MongoDBJSONSchema, ExpandedJSONSchema } from './types';
24+
import { AnyIterable, StandardJSONSchema, MongoDBJSONSchema, ExpandedJSONSchema, JSONSchema } from './types';
2525
import { toTypescriptTypeDefinition } from './to-typescript';
2626

2727
/**
@@ -86,6 +86,7 @@ export type {
8686
StandardJSONSchema,
8787
MongoDBJSONSchema,
8888
ExpandedJSONSchema,
89+
JSONSchema,
8990
SchemaAccessor
9091
};
9192

src/to-typescript.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import type { JSONSchema4 } from 'json-schema';
2-
import type { MongoDBJSONSchema } from './types';
3-
4-
export type JSONSchema = Partial<JSONSchema4> & MongoDBJSONSchema;
1+
import type { JSONSchema } from './types';
52

63
function getBSONType(property: JSONSchema): string | string[] | undefined {
74
return property.bsonType || property.type;

src/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export type ExpandedJSONSchema = StandardJSONSchema & {
2323
anyOf?: ExpandedJSONSchema[];
2424
}
2525

26+
export type JSONSchema = Partial<JSONSchema4> & MongoDBJSONSchema;
27+
2628
export type AnyIterable<T = any> = Iterable<T> | AsyncIterable<T>;
2729

2830
type AnySchema = InternalSchema | StandardJSONSchema | MongoDBJSONSchema | ExpandedJSONSchema;

0 commit comments

Comments
 (0)