I want to implement functions that act on specific numpy structured arrays, but typeguard doesn't seem to work properly: import numpy as np from typeguard import typechecked mytype2 = np.dtype([("type", int), ("pos", float, 2)]) mytype3 = np.dtype([("type", int), ("pos", float, 3)]) @typechecked def process(data: mytype3) -> None: # Variable not allowed in type expression Pylance print(data) data = np.array([(1, [2, 3])], dtype=mytype2) process(data) That works fine, when it should raise an error. Continue reading...