Closed creme332 closed 10 months ago
Thanks for creating an issue. I am able to reproduce your error.
It appears that an easy fix is to remove:
from __future__ import annotations
That line modifies the way annotations are handled (they are postponed). This prevents the type_enforced
package from being able to handle annotations correctly as python stores them differently under the hood.
This postponed structure will possibly be introduced as the default in python4, but we will not add support for it until it is official. Originally, this was supposed to be the case in python3.10, however it keeps getting pushed back.
Please close this issue if it is resolved.
Thank you. I had from __future__ import annotations
in my code because it fixes an error that Pylance threw when I use union types as such int | float
. By removing from __future__ import annotations
, I had to use another syntax for union types: [int | float]
.
I am using python 3.9.18 and type-enforced 1.2.0 and the following code causes an error:
Error produced:
Any help is appreciated. Thanks.