import React from 'react';
import type { JSONOutput } from 'typedoc';
import { TokenKeyword, TokenPunctuation, TokenType } from './tokens';
import renderType from './renderType';
import Indent from './Indent';
import Params from './Params';
import reduceReflectionsWith from './reduceReflectionsWith';
function renderTypeParam(
typeParam: JSONOutput.TypeParameterReflection,
params: Params
) {
const nameToken = {typeParam.name};
return (
<>
{params.resolveTypeParamsLinks ? (
{nameToken}
) : (
nameToken
)}
{typeParam.type && (
<>
extends
{renderType(typeParam.type, params)}
>
)}
>
);
}
export default function renderTypeParameters(
typeParams: JSONOutput.TypeParameterReflection[],
params: Params
) {
if (!typeParams) {
return null;
}
return (
<>
<
{typeParams.reduce(
reduceReflectionsWith(',', params, renderTypeParam, true),
null
)}
>
>
);
}