Skip to content

How to accept Annotated types as well as normal types? #7849

Answered by erictraut
superlopuh asked this question in Q&A
Discussion options

You must be logged in to vote

Annotated is intended to be used in type expressions (i.e. type annotations). You're using it here in a value expression. See this issue for more details.

What are you doing in my_function with the value you pass to it? The value MyTypealias is not a valid class object, so my_function is not going to be able to use it as a normal type. For example, if there is a class variable defined on MyClass, you won't be able to access it using arg.my_class_var.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@superlopuh
Comment options

@erictraut
Comment options

Answer selected by superlopuh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants