import typing y = typing.cast(MyType, [x]) # Rule triggers: MyType is not a string