Based on the official Python documentation about @runtime_checkable 12, the decorator should only be applied on a Protocol class. Since DataLoader is not, it will raise the TypeError that you are seeing if you add @runtime_checkable just before the DataLoader class.