(lit: NonNullable<TsType['typeLiteral']>)
| 122 | } |
| 123 | |
| 124 | function formatTypeLiteralType(lit: NonNullable<TsType['typeLiteral']>): string { |
| 125 | const parts: string[] = [] |
| 126 | for (const prop of lit.properties) { |
| 127 | const opt = prop.optional ? '?' : '' |
| 128 | const ro = prop.readonly ? 'readonly ' : '' |
| 129 | parts.push(`${ro}${prop.name}${opt}: ${formatType(prop.tsType) || 'unknown'}`) |
| 130 | } |
| 131 | for (const method of lit.methods) { |
| 132 | const params = method.params?.map(p => formatParam(p)).join(', ') || '' |
| 133 | const ret = formatType(method.returnType) || 'void' |
| 134 | parts.push(`${method.name}(${params}): ${ret}`) |
| 135 | } |
| 136 | return `{ ${parts.join('; ')} }` |
| 137 | } |
no test coverage detected