JSONLD types are specified with @type, and the range of a @type attribute includes rdfs:Class.
icontract and pycontracts (Design-by-Contract programming) have runtime type and constraint checking; data validation. Preconditions, Command, Postconditions (assertions, assertions of invariance after command C_funcname executed) https://github.com/Parquery/icontract
Have you ever tried [Pydantic](https://docs.pydantic.dev)!? It may be what you need for type safety / data validation.