These if and comment are from Typer. For now I haven't refactored code - it's easier to check ContextCreator with similar context creation flow as typer has.