Wix Code Local Editor typescript support

Velo is a great tool - fast to prototype and fun to play around with an amazing documentation full of explanations and examples.
Geeky developers love experimenting and trying out better ways to organize their code. Velo is also evolving and there are performance gains to keeping up to date with the newest APIs. This requires refactoring. Once the project grows, refactoring and code maintenance become harder and more time consuming. There are solutions that help maintaining growing code base and TypeScript is one of them.
Since Velo does not support TypeScript out of the box. There’s no way to get native TypeScript support, but now there’s a library to write TypeScript code using Local Editor .

Wix Code Typescript Wrapper

@astrauka/wix-code-typescript-wrapper compiles the TypeScript to JavaScript and puts it where Local Editor expects to find the local files. There are important limitations you should know such as no TypeScript support in Web Editor and no pageElements auto-completion.
The library is not developed or supported by Wix, so if Local Editor API changes, the development flow will break and there will be a need to adopt to it.

Getting started

Please take time to read the details of how it works an it’s limitations in project readme . You’ll avoid a lot of frustration if you do so before trying it out.
There’s an example project with minimal configuration demonstrating the supported features.

Becoming a pro

Once you crack the example project and want to build more advanced project with unit tests, end-to-end tests, dependency injection and layered architecture, check out teachers-portal project for ideas and configuration examples.

Making the library better

Contributions are welcome - all of us could benefit if you joined the project and started contributing to it. I am looking forward to meeting you and discussing of how this library can evolve.
It would really help to learn from the feedback about your experience setting up and using the library. This would enable improving documentation such that others don’t get stuck on the same issue.

Summary

There is a way to write Velo code in TypeScript. It’s not native and not perfect, but it’s still a good addition to the Velo ecosystem.

3 Likes

Why not. The more options the more flexibility on coding sites, the better endresults. Thumbs up!