UNPKG

ts-to-mongo-schema

Version:

Using the Typescript Compiler API, this program parses through Typescript, to generate a JSON Schema that conforms to MongoDB's bson format. Useful when generating large schemas, and being unable to use a javascript or typescript library like Moongoose.

33 lines (32 loc) 828 B
import { ts } from "ts-morph"; export declare type ResolveCustomParams = { propertiesPerArg?: any[]; combinedProperties?: { [key: string]: any; }; }; export declare type ExtractProps = { imports: { [key: string]: string; }; ids: { [key: string]: ts.Node; }; node: ts.Node; props: { [key: string]: any; }; paths: { configPath: string; filePath: string; identifier: string; }; resolveCustomGenerics?: { [key: string]: (params: ResolveCustomParams) => any; }; extension: ".tsx" | ".ts"; }; declare function extractProperties({ imports, ids, node, paths, props, resolveCustomGenerics, extension }: ExtractProps): { [key: string]: any; }; export default extractProperties;