Open Jason2605 opened 1 year ago
Definitely in favor of the :
option.
Python's way of handling type hints is especially tricky and weird, given that it treats everything after the :
or ->
as a normal language expression that doesn't produce any bytecode, essentially a comment.
It's also interesting how Typescript, but usually Javascript, handle type hints inside separate .d.ts
files which basically only contain the relevant hints to functions, classes and attributes.
Python's way of handling type hints is especially tricky and weird, given that it treats everything after the : or -> as a normal language expression that doesn't produce any bytecode, essentially a comment.
I was thinking something similar, except unlike python, it doesn't even need to be a valid identifier (will massively simplify things for us).
Yeah the d.ts files allow you to have type information about some public API written in JS, I think for us, we'd probably just have it mixed into the actual source file (rather than a separate dedicated file) - again will be simpler to implement
Is there an existing issue for this?
Is your feature request related to a problem?
Building out a fully blown type system is probably a little above my pay grade, however, what we can potentially do is add type hints into dictu. These would function exactly the same as Python's type hints (which are essentially glorified comments) but will allow us to use external tools to check for things, or even just provide a little more clarity to the developer about a type even if there isn't actually any checking taking place
Describe the solution you'd like
Something along the lines of:
Describe alternatives you've considered
No response
Additional context
No response