from __future__ import annotations from typing import TypedDict, List, Union class ArticleConfig(TypedDict): slug: str name: str iso_date: str author: str class ArticleContext(TypedDict): slug: str name: str url: str link: str date: str iso_date: str author: str translations: List[ArticleTranslationContext] children: List[ArticleContext] breadcrumbs: List[ArticleContext] linked: List[ArticleContext] related: List[ArticleContext] class TypedLanguage(TypedDict): flag: str name: str native_name: str priority: int code: str class ArticleTranslationContext(TypedDict): slug: str name: str url: str link: str date: str iso_date: str author: str language: TypedLanguage article_url: str """ The type Union[ArticleTranslationContext, ArticleContext] exist, because if the article it is linked to doesn't exist in the same languages it uses the overview instead. If you dislike this behavior set: config.fall_back_to_overview_in_translation = False """ children: List[Union[ArticleTranslationContext, ArticleContext]] breadcrumbs: List[Union[ArticleTranslationContext, ArticleContext]] # you can't use these within the markdown text itself content: str preview: str linked: List[Union[ArticleTranslationContext, ArticleContext]] related: List[Union[ArticleTranslationContext, ArticleContext]]