interface Props {
content: Content[]
}
const ContentTypes = ({ content }: Props) => {
return (
<>
{content.map((v, i) => {
if(v.type === 'text') return <ContentText content={v} key={i} />
else if(v.type === 'header') return <ContentHeader content={v} key={i} />
// ...
})}
</>
);
};
// ...
const ContentText = (props) => {
const content:ITextContent = props.content;
return <ReactMarkdown>{content.value}</ReactMarkdown>;
};
for(obj1) {
for(obj1) {
if(val1 == val2) {
count++;
break;
}
}
}
for(key in arr1) {
if(key in arr2) {
count++;
}
}
Сам решил так: https://qna.habr.com/answer?answer_id=2245682#answ...
Подсмотрел решение тут: https://github.com/microsoft/TypeScript/issues/14094