According to the argparse documentation, The action argument of argparse.ArgumentParser.add_subparsers can accept anything that the argument of the same name in argparse.ArgumentParser.add_argument can take. This implies that the type hint for that argument should be str | type[Action], rather than the current type[Action].
Some basic testing seems to imply that this is, in fact, true.
>>> import argparse
>>> parser1 = argparse.ArgumentParser()
>>> subparsers1 = parser1.add_subparsers(dest='command', action='parsers')
>>> subparsers1.add_parser('build')
ArgumentParser(prog=' build', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
According to the
argparsedocumentation, Theactionargument ofargparse.ArgumentParser.add_subparserscan accept anything that the argument of the same name inargparse.ArgumentParser.add_argumentcan take. This implies that the type hint for that argument should bestr | type[Action], rather than the currenttype[Action].Some basic testing seems to imply that this is, in fact, true.