UNPKG

ts-json-schema-generator

Version:

Generate JSON schema from your Typescript sources

23 lines (18 loc) 662 B
import type { Definition } from "../Schema/Definition.js"; import type { SubTypeFormatter } from "../SubTypeFormatter.js"; import type { BaseType } from "../Type/BaseType.js"; import { UnknownType } from "../Type/UnknownType.js"; export class UnknownTypeFormatter implements SubTypeFormatter { public supportsType(type: BaseType): boolean { return type instanceof UnknownType; } public getDefinition(type: UnknownType): Definition { if (type.erroredSource) { return { description: "Failed to correctly infer type" }; } return {}; } public getChildren(): BaseType[] { return []; } }