ts-json-schema-generator
Version:
Generate JSON schema from your Typescript sources
44 lines • 1.89 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.derefAliasedType = exports.isHiddenType = exports.derefAnnotatedType = exports.derefType = void 0;
const AliasType_js_1 = require("../Type/AliasType.js");
const AnnotatedType_js_1 = require("../Type/AnnotatedType.js");
const DefinitionType_js_1 = require("../Type/DefinitionType.js");
const HiddenType_js_1 = require("../Type/HiddenType.js");
const NeverType_js_1 = require("../Type/NeverType.js");
const ReferenceType_js_1 = require("../Type/ReferenceType.js");
function derefType(type) {
if (type instanceof DefinitionType_js_1.DefinitionType || type instanceof AliasType_js_1.AliasType || type instanceof AnnotatedType_js_1.AnnotatedType) {
return derefType(type.getType());
}
if (type instanceof ReferenceType_js_1.ReferenceType && type.hasType()) {
return derefType(type.getType());
}
return type;
}
exports.derefType = derefType;
function derefAnnotatedType(type) {
if (type instanceof AnnotatedType_js_1.AnnotatedType || type instanceof AliasType_js_1.AliasType) {
return derefAnnotatedType(type.getType());
}
return type;
}
exports.derefAnnotatedType = derefAnnotatedType;
function isHiddenType(type) {
if (type instanceof HiddenType_js_1.HiddenType || type instanceof NeverType_js_1.NeverType) {
return true;
}
else if (type instanceof DefinitionType_js_1.DefinitionType || type instanceof AliasType_js_1.AliasType || type instanceof AnnotatedType_js_1.AnnotatedType) {
return isHiddenType(type.getType());
}
return false;
}
exports.isHiddenType = isHiddenType;
function derefAliasedType(type) {
if (type instanceof AliasType_js_1.AliasType) {
return derefAliasedType(type.getType());
}
return type;
}
exports.derefAliasedType = derefAliasedType;
//# sourceMappingURL=derefType.js.map
;