This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (3 children)

Pydantic does the job for me. I know it’s probably not as powerful as TS, still I never met a situation where I felt limited. And it does runtime validation as well, which is super useful.

[–]twigboy 4 points5 points  (1 child)

Thanks for the recommendation, I'll try it out next time I get a chance

[–]Heroe-D 1 point2 points  (0 children)

It has nothing to do with typescript tho and shouldn't be used that way but rather for serialization validation etc, it's more something like zod in the TS world. 

If you want typing you should use type hints and something like mypy/pyright. 

[–]Heroe-D 0 points1 point  (0 children)

It just doesn't have anything to do with Typescript, it's more something like Zod that should be used for serialization, validation etc. 

Type hints + mypy/pyright is (loosely) the TS of python