casual-simulation / casualos

Casual Open Simulation for the Web
https://ab1.bot
MIT License
48 stars 9 forks source link

Add TypeScript Support #383

Closed KallynGowdy closed 5 months ago

KallynGowdy commented 6 months ago

Currently, the only way to document types and interfaces for scripts is to use documentation comments. Ideally, users will be able to use TypeScript to properly define types. Additionally, the monaco-editor already supports TypeScript with validation, so supporting TypeScript has the potential to greatly improve user experience with writing scripts.

Currently, we use Acorn as the JavaScript parser. There is a plugin for Acorn that enables parsing TypeScript called acorn-typescript. This task is to support parsing TypeScript using the plugin and then also implement a transpiler to remove all the TypeScript annotations so that scripts are compiled down to JavaScript for the runtime.

Blitzy commented 6 months ago

This would transform large scale projects.