I have evaluated several "typed Lua" solutions[1]. Haxe might be a bit too heavy-weight depending on what you try to do. There're Teal and TypeScriptToLua which might be a better fit.
I recently did a fairly large undertaking with TypescriptToLua.
(Porting the Lua API + types of a major music DAW to TS types to make it possible to write type-checked scripts in JS/TS).
The experience was mostly smooth, barring a few bumps of non-standard TS stuff. (It's also very actively developed)
BUT, the community is amazing. They have a Discord server where the core devs are active and very helpful, they quickly and politely helped me fix the small issues I ran into.
I never knew Haxe was capable of this, so I can't give a fair assessment, but now I am interested in trying it as well!
At the time I started working on my scripts - sometime in 2019 - I think neither Teal, nor TSToLua existed. Not 100% sure about that, but I remember searching for type systems for Lua and coming back empty handed back then :(
I'll take a closer look at both, they seem interesting.
[1] https://ruoyusun.com/2021/01/31/typed-lua.html