function getTypeStrings()

in jsdoc/services/transforms/extract-type.js [69:112]


  function getTypeStrings(parsedType) {
    const types = [];

    const TYPES = catharsis.Types;
    const util = require('util');

    switch(parsedType.type) {
      case TYPES.AllLiteral:
        types.push('*');
        break;
      case TYPES.FunctionType:
        types.push(catharsis.stringify(parsedType));
        break;
      case TYPES.NameExpression:
        types.push(parsedType.name);
        break;
      case TYPES.NullLiteral:
        types.push('null');
        break;
      case TYPES.RecordType:
        types.push(catharsis.stringify(parsedType));
        break;
      case TYPES.TypeApplication:
        types.push( catharsis.stringify(parsedType) );
        break;
      case TYPES.TypeUnion:
        parsedType.elements.forEach(element => {
          types.push(...getTypeStrings(element));
        });
        break;
      case TYPES.UndefinedLiteral:
        types.push('undefined');
        break;
      case TYPES.UnknownLiteral:
        types.push('?');
        break;
      default:
        // this shouldn't happen
        throw new Error( util.format('unrecognized type %s in parsed type: %j', parsedType.type,
          parsedType) );
    }

    return types;
  }