A discussion in the Discord reminded me of another concern I had.
It appears that Teal is not supported in script
or gui_script
files. Each time you need to write a boilerplate to import it.
If this extends to all transpiled languages, I think it adds a couple complications:
- If you’re a newcomer who wants to use TS with Defold, you will still need to learn enough Lua to setup the boilerplate code (I realize you could learn this in minutes, but it’s still a cognitive barrier)
- Our current implementation doesn’t have this requirement (a
example.script.ts
file magically becomes a Luaexample.script
file when you save it), so switching to the way the Teal extension handles it would be a regression in user experience in this regard
Absolutely, although if you do that too often you lose the benefits of a strictly typed language.
There are some edge cases where we can’t operate without proper type data. For instance, Lua supports multiple return values from a function. TypeScript cannot natively handle that. So we need to know in advance the shape of data we’re getting and wrap it in the LuaMultiReturn keyword to handle that scenario.
Welcome to the forums!