I love Nix and the only thing I really miss when using it is the lack of type annotation in the code, static typing, etc. In particular, it would be nice to require attributes to be of a certain type, and annotations would be nice to make the code more self-documenting. Static typing would also make errors a bit more readable and easier to catch earlier and of course, they are also advantageous for language servers, linters, etc.
Given that Nix is here to stay and any change like adding type hints would take a ton of time and effort, are there any libraries that attempt to remedy this in part? I’m thinking something like validation for attribute sets to ensure that all required attributes are present and have the required type.
On a related note, are there any tools that take an approach similar to typescript or type-annotated python? A type validation step, akin to typescript compilation to javascript, would be worth the hassle for me if I get the solidity and guarantees of static type-checking. Having optional type annotations like Python, while clearly weaker, would be nice because Nix would work as it already does, sacrificing nothing in terms of compatibility, but still support static type-checking for those who desire it ( as mypy does for python). Given the similarities to JSON, even something like JSON schema validation would be nice to have.
Perhaps I’m a bit naive as to just how important dynamic typing is for Nix and the way it works. If so, I’d love to hear more about that.
Sorry if this is the wrong category for this post. I’m new here and not trying to step on anyone’s toes.