> this also seems a way to declare types for your own code in an external file, thus keeping your code as runnable Lua and benefiting from type checking too
The declaration file isn't used to typecheck the code the declaration is for. It is only for consumers of the code.
Ah that's a shame. I was hoping it would work via sidecar files like Ruby's RBS [1] or Python's stub files [2]
I was editing my comment during your reply, and added this:
> or maybe https://github.com/teal-language/tl#loading-teal-code-from-l... this is the easier way to do it. `require` and use `loader` during development, generate the Lua once things are somewhat stable.
Does that sound like the right idea then?
[1] https://github.com/ruby/rbs [2] https://mypy.readthedocs.io/en/stable/stubs.html