@namecheap/tsoa-cli
Version:
Build swagger-compliant REST APIs using TypeScript and Node
64 lines • 1.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRefType = isRefType;
// This file is designed to contain functions that narrow the input type to a type within src\metadataGeneration\tsoa.ts
const tsoa_runtime_1 = require("@namecheap/tsoa-runtime");
/**
* This will help us do exhaustive matching against only reference types. For example, once you have narrowed the input, you don't then have to check the case where it's a `integer` because it never will be.
*/
function isRefType(metaType) {
switch (metaType.dataType) {
case 'any':
return false;
case 'array':
return false;
case 'binary':
return false;
case 'boolean':
return false;
case 'buffer':
return false;
case 'byte':
return false;
case 'date':
return false;
case 'file':
return false;
case 'datetime':
return false;
case 'double':
return false;
case 'enum':
return false;
case 'float':
return false;
case 'integer':
return false;
case 'intersection':
return false;
case 'long':
return false;
case 'nestedObjectLiteral':
return false;
case 'object':
return false;
case 'refEnum':
return true;
case 'refObject':
return true;
case 'refAlias':
return true;
case 'string':
return false;
case 'union':
return false;
case 'void':
return false;
case 'undefined':
return false;
default: {
return (0, tsoa_runtime_1.assertNever)(metaType);
}
}
}
//# sourceMappingURL=internalTypeGuards.js.map