in packages/typespec-go/src/tcgcadapter/clients.ts [705:756]
private recursiveTypeName(type: tcgc.SdkType, fromArray: boolean): string {
if (!fromArray) {
switch (type.kind) {
case 'array':
return `${this.recursiveTypeName(type.valueType, true)}Array`;
case 'nullable':
return this.recursiveTypeName(type.type, false);
case 'unknown':
return this.ta.codeModel.options.rawJSONAsBytes ? 'RawJSON' : 'Interface';
default:
return 'Value';
}
}
switch (type.kind) {
case 'array':
return `${this.recursiveTypeName(type.valueType, true)}Array`;
case 'boolean':
return 'Bool';
case 'bytes':
return 'ByteArray';
case 'enum':
return type.name;
case 'utcDateTime':
case 'offsetDateTime':
return 'Time';
case 'decimal':
case 'decimal128':
return 'Float64';
case 'dict':
return `MapOf${this.recursiveTypeName(type.valueType, fromArray)}`;
case 'float32':
case 'float64':
case 'int16':
case 'int32':
case 'int64':
case 'int8':
return capitalize(type.kind);
case 'model':
return type.name;
case 'nullable':
return this.recursiveTypeName(type.type, fromArray);
case 'duration':
case 'string':
case 'url':
return 'String';
case 'unknown':
return this.ta.codeModel.options.rawJSONAsBytes ? 'RawJSON' : 'Interface';
default:
throw new Error(`unhandled monomorphic response type kind ${type.kind}`);
}
}