Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile TypeScript to JavaScript before executing #941

Merged
merged 7 commits into from
May 28, 2024

Conversation

vixalien
Copy link
Contributor

This basically compiles from TypeScript to JavaScript at runtime when the "Run" button is clicked.

However, there are currently 2 issues worth mentioning:

1. Speed

Notice that this is noticeably slow because it's using tsc. It could possibly be improved by using esbuild, swc, babel or something similar but then there will be no typechecking when the "Run" button is clicked.

However, I think the above typechecking caveat will not make much sense when we have real-time Intellisense in the editor for TypeScript.

2. Sourcemaps

Another consideration is the lack of sourcemap support in GJS. While tsc can generate sourcemaps, this feature is disabled because GJS won't use them. This means that some errors will have the wrong line:column information.

For example:

image

Workbench/GJS reports the error is on line number 17 even if it's actually on line number 22 because that's where it ends up after it's compiled to JavaScript (many compilers will eat up unnecessary line breaks even though the minify option is turned off).

I left some TODOs in here where some decisions need to be made and hope to get some feedback

Copy link
Contributor

@sonnyp sonnyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

src/workbench Show resolved Hide resolved
src/langs/typescript/Compiler.js Outdated Show resolved Hide resolved
src/window.js Show resolved Hide resolved
@vixalien vixalien requested a review from sonnyp May 27, 2024 14:30
Copy link
Contributor

@sonnyp sonnyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@sonnyp sonnyp merged commit 915fe99 into typescript May 28, 2024
@sonnyp sonnyp deleted the wip/vixalien/typescript/compile branch May 28, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants