# prefect-server

Alexander van Eck

09/02/2021, 9:55 AM
Hello 👋 I would love to use Parameter and mypy together. However currently when I do;
Copy code
var: str = Parameter('var')
mypy complains with
Copy code
Incompatible types in assignment (expression has type "Parameter", variable has type "str")
Even though after calling this will be a string 🤔 Any thoughts on how to achieve this?

Bouke Krom

09/02/2021, 11:53 AM
If you do this in a
with Flow(name) as flow:
context, the returned value will actually not be a string but a task... We didnt implement type checking on tasks/parameters though, so I'm not sure how to solve it.

Zach Angell

09/02/2021, 1:50 PM
Hi @Alexander van Eck, this can be tricky. Because of deferred execution of course mypy is correct,
IS a
until it's evaluated at flow run time. A couple possibilities I can think of 1. use a union of types
var: Union[str, Parameter] = Parameter('var')
2. tell mypy to ignore it
var: str = Parameter('var') # type: ignore
We're working on some features that will allow Parameter typing (and enforcement of typing!!) in the future.

Alexander van Eck

09/02/2021, 1:51 PM
Great to hear @Zach Angell 🙂 I’ve gone with
where necessary. but it looks like when passing Parameter into a prefect task it actually doesn’t complain! Just when using Parameter directly
🚀 1