Is there interest from the community to have transpiled TypeScript language support added to the Defold editor and build pipeline?
Current Approach
I’m one of the maintainers of the current ts-defold project. We provide a CLI for getting started and plenty of templates.
As it stands now, we provide support for writing TypeScript in external tools like VSCode, and we use the NodeJS runtime to transpile your TS code to Lua that Defold understands.
Hotkeys to build your project and hot reload aren’t part of the default template, but can be added to VSCode through an extension like Defold Buddy.
Pros
These features are all available and highly configurable thanks to TypeScript’s robust ecosystem of tools:
- Static code analysis
- Syntax highlighting
- Linting
- Autocomplete suggestions
- Auto-formatting on save
Cons
- Dependencies: you must install the Node runtime locally
- Workflow: you need to use an external editor while writing code
- Extensions: we support most popular Defold extensions, but the process isn’t automatic: as maintainers we have to produce, test, and maintain the type data ourselves
A Different Approach
It’s now theoretically possible for TypeScript to be integrated into the Defold editor and build pipeline. However, creating and maintaining such a project would require a chunk of time and effort (probably unpaid).
This integration would solve the 1st and 2nd issue in my list of cons for our current TS implementation.
Perhaps one day it could also fix the third issue, although I don’t think the Defold pipeline currently has the ability to provide accurate static type data for the Defold API and extensions (both Lua and native).
Feedback
To sum up, we currently having a working approach (via external tools like VSCode), but we could instead pursue tighter integration with the Defold editor. Do you find our current list of cons to be deal-breakers? Would you use TypeScript in your projects if it were integrated with the Defold editor?